Skip to content

Commit 7ecc48d

Browse files
authored
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: #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>
1 parent 12f92b0 commit 7ecc48d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/parallel/test-vm-context-dont-contextify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function checkFrozen(context) {
176176
const namespace = await import(moduleUrl.href);
177177
// Check dynamic import works
178178
const context = vm.createContext(vm.constants.DONT_CONTEXTIFY);
179-
const script = new vm.Script(`import('${encodeURI(moduleUrl.href)}')`, {
179+
const script = new vm.Script(`import(${JSON.stringify(moduleUrl)})`, {
180180
importModuleDynamically: vm.constants.USE_MAIN_CONTEXT_DEFAULT_LOADER,
181181
});
182182
const promise = script.runInContext(context);

0 commit comments

Comments
 (0)