-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
module: correctly detect top-level await in ambiguous contexts #58646
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #58646 +/- ##
==========================================
- Coverage 90.15% 90.14% -0.02%
==========================================
Files 636 637 +1
Lines 188028 188125 +97
Branches 36895 36894 -1
==========================================
+ Hits 169526 169581 +55
- Misses 11231 11278 +47
+ Partials 7271 7266 -5
🚀 New features to boost your workflow:
|
@@ -423,3 +423,77 @@ describe('when working with Worker threads', () => { | |||
strictEqual(signal, null); | |||
}); | |||
}); | |||
|
|||
describe('maybe top-level await syntax errors that are not recognized as top-level await errors', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is already too long with too many things mixed together. Can you add the new tests to a new file? https://github.com/nodejs/node/blob/main/doc/contributing/writing-tests.md#how-to-write-a-good-test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I've moved the test to a new file.
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.