Skip to content

Commit

Permalink
test: fix test-vm-context-dont-contextify when path contains a space
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
aduh95 authored and marco-ippolito committed Nov 17, 2024
1 parent 6e5d524 commit 9640661
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/parallel/test-vm-context-dont-contextify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9640661

Please sign in to comment.