mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04: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:
1 parent
b6fc9adf5b
commit
c56e324cb8
1 file changed
+1
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user