node icon indicating copy to clipboard operation
node copied to clipboard

module: correctly detect top-level await in ambiguous contexts

Open islandryu opened this issue 6 months ago • 2 comments

Fixes: https://github.com/nodejs/node/issues/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.

islandryu avatar Jun 09 '25 14:06 islandryu

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 90.11%. Comparing base (4d5ee24) to head (993bcfc). :warning: 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%) :arrow_up:

... and 31 files with indirect coverage changes

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

codecov[bot] avatar Jun 09 '25 15:06 codecov[bot]

CI: https://ci.nodejs.org/job/node-test-pull-request/67387/

nodejs-github-bot avatar Jun 10 '25 17:06 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/67585/

nodejs-github-bot avatar Jun 21 '25 09:06 nodejs-github-bot

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

islandryu avatar Jun 29 '25 14:06 islandryu

CI: https://ci.nodejs.org/job/node-test-pull-request/68576/

nodejs-github-bot avatar Aug 12 '25 09:08 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/68645/

nodejs-github-bot avatar Aug 15 '25 05:08 nodejs-github-bot

Landed in 360f7cc7867b43344aac00564286b895e15f21d7

nodejs-github-bot avatar Aug 15 '25 22:08 nodejs-github-bot