diff --git a/test/parallel/test-vm-context-dont-contextify.js b/test/parallel/test-vm-context-dont-contextify.js index 6cbd62e8947..d75fc1438d3 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);