From 08c8705ecf29127e6dc110f7c18537d7ada569ce Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 19 May 2024 22:44:24 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Geoffrey Booth --- src/node_contextify.cc | 2 ++ test/es-module/test-esm-detect-ambiguous.mjs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 42c1175d29962d..bd85e1d8d5a41b 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -1708,6 +1708,8 @@ static void ContainsModuleSyntax(const FunctionCallbackInfo& args) { resource_name = args[2].As(); } // Argument 4: flag to indicate if CJS variables should not be in scope + // (they should be for normal CommonJS modules, but not for the + // CommonJS eval scope). bool cjs_var = !args[3]->IsString(); bool cache_rejected = false; diff --git a/test/es-module/test-esm-detect-ambiguous.mjs b/test/es-module/test-esm-detect-ambiguous.mjs index 9ca813c3da7eb7..e2b73f7436096e 100644 --- a/test/es-module/test-esm-detect-ambiguous.mjs +++ b/test/es-module/test-esm-detect-ambiguous.mjs @@ -408,7 +408,7 @@ describe('Wrapping a `require` of an ES module while using `--abort-on-uncaught- }); describe('when working with Worker threads', () => { - it('should work', async () => { + it('should evaluate a CommonJS worker as valid sloppy script where the CommonJS wrapper variables do not exist', async () => { const { code, signal, stdout, stderr } = await spawnPromisified(process.execPath, [ '--experimental-detect-module', '--eval',