module: correctly detect top-level await in ambiguous contexts
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.
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: |
: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.
CI: https://ci.nodejs.org/job/node-test-pull-request/67387/
CI: https://ci.nodejs.org/job/node-test-pull-request/67585/
I added several tests to confirm that unrelated errors are not affected by top-level await.
CI: https://ci.nodejs.org/job/node-test-pull-request/68576/
CI: https://ci.nodejs.org/job/node-test-pull-request/68645/
Landed in 360f7cc7867b43344aac00564286b895e15f21d7