diff --git a/test/parallel/test-vm-context-dont-contextify.js b/test/parallel/test-vm-context-dont-contextify.js index 6cbd62e8947b3d..d75fc1438d364a 100644 --- a/test/parallel/test-vm-context-dont-contextify.js +++ b/test/parallel/test-vm-context-dont-contextify.js @@ -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);