Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module: do not set CJS variables for Worker eval #53050

Merged
merged 5 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,8 @@ static void ContainsModuleSyntax(const FunctionCallbackInfo<Value>& args) {
resource_name = args[2].As<String>();
}
// Argument 4: flag to indicate if CJS variables should not be in scope
aduh95 marked this conversation as resolved.
Show resolved Hide resolved
// (they should be for normal CommonJS modules, but not for the
// CommonJS eval scope).
bool cjs_var = !args[3]->IsString();

bool cache_rejected = false;
Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-esm-detect-ambiguous.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@
});

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 () => {

Check failure on line 411 in test/es-module/test-esm-detect-ambiguous.mjs

View workflow job for this annotation

GitHub Actions / lint-js-and-md

This line has a length of 128. Maximum allowed is 120
aduh95 marked this conversation as resolved.
Show resolved Hide resolved
const { code, signal, stdout, stderr } = await spawnPromisified(process.execPath, [
'--experimental-detect-module',
'--eval',
Expand Down
Loading