Skip to content

Conversation

@islandryu
Copy link
Member

@islandryu islandryu commented Jun 9, 2025

Fixes: #58331

Many syntax errors are incorrectly treated as requiring ESM recompilation, but since they can't be clearly distinguished from top-level await-related errors, the current fix ends up handling them together.

From what I can tell by looking at the issues reported on V8, this appears to be a problem on the V8 side, so I will see if a fix can be made there.
https://issues.chromium.org/issues/40070895#comment1

That said, this patch will be necessary until the issue is resolved in V8.

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. vm Issues and PRs related to the vm subsystem. labels Jun 9, 2025
@codecov
Copy link

codecov bot commented Jun 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.11%. Comparing base (4d5ee24) to head (993bcfc).
⚠️ Report is 274 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58646      +/-   ##
==========================================
+ Coverage   90.10%   90.11%   +0.01%     
==========================================
  Files         640      640              
  Lines      188493   188431      -62     
  Branches    36971    36965       -6     
==========================================
- Hits       169843   169808      -35     
+ Misses      11358    11342      -16     
+ Partials     7292     7281      -11     
Files with missing lines Coverage Δ
src/node_contextify.cc 81.30% <100.00%> (+0.06%) ⬆️

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Ethan-Arrowood Ethan-Arrowood added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 10, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 10, 2025
@nodejs-github-bot
Copy link
Collaborator

@islandryu islandryu added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 21, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 21, 2025
@nodejs-github-bot
Copy link
Collaborator

std::array<std::string_view, 2>{// example: `func(await 1);`
"missing ) after argument list",
// example: `if(await 1)`
"SyntaxError: Unexpected"};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the linter/formatter format the code this way?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but now that you mention it, it's a weird format.
I've changed the comment's position.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasnell
Could you take another look when you have a moment?

Copy link
Member

@joyeecheung joyeecheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some tests to ensure that unrelated errors stays the same? For example, when it's const foo bar (which is supposed to throw SyntaxError: Unexpected identifier 'bar') or console.log('PI: ' Math.PI); (which is supposed throw missing ) after argument list).

@islandryu
Copy link
Member Author

I added several tests to confirm that unrelated errors are not affected by top-level await.

@islandryu islandryu requested a review from joyeecheung June 29, 2025 14:51
…a-error.mjs

Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
@islandryu islandryu requested a review from joyeecheung July 2, 2025 02:10
@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 12, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 12, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@islandryu islandryu added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. commit-queue Add this label to land a pull request using GitHub Actions. labels Aug 15, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 15, 2025
@nodejs-github-bot nodejs-github-bot merged commit 360f7cc into nodejs:main Aug 15, 2025
64 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 360f7cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. vm Issues and PRs related to the vm subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESM syntax detection ignores certain top-level awaits

6 participants