mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
test: fix test-vm-context-dont-contextify
when path contains a space
Because of the double encoding, the test would fail as soon as the path contains a space or any other char that's already encoded by `pathToFileURL`. PR-URL: https://github.com/nodejs/node/pull/55026 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
12f92b04f4
commit
7ecc48d061
@ -176,7 +176,7 @@ function checkFrozen(context) {
|
||||
const namespace = await import(moduleUrl.href);
|
||||
// Check dynamic import works
|
||||
const context = vm.createContext(vm.constants.DONT_CONTEXTIFY);
|
||||
const script = new vm.Script(`import('${encodeURI(moduleUrl.href)}')`, {
|
||||
const script = new vm.Script(`import(${JSON.stringify(moduleUrl)})`, {
|
||||
importModuleDynamically: vm.constants.USE_MAIN_CONTEXT_DEFAULT_LOADER,
|
||||
});
|
||||
const promise = script.runInContext(context);
|
||||
|
Loading…
Reference in New Issue
Block a user