-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
test: fix dangling promise in test_runner no isolation test setup #57595
base: main
Are you sure you want to change the base?
test: fix dangling promise in test_runner no isolation test setup #57595
Conversation
Review requested:
|
The test is passing on the before(): global
before one: <root>
suite one
before two: <root>
suite two
- beforeEach(): global
beforeEach one: suite one - test
beforeEach two: suite one - test
suite one - test
- afterEach(): global
afterEach one: suite one - test
afterEach two: suite one - test
before suite two: suite two
- beforeEach(): global
beforeEach one: suite two - test
beforeEach two: suite two - test
suite two - test
- afterEach(): global
afterEach one: suite two - test
afterEach two: suite two - test
- after(): global
after one: <root>
after two: <root> @avivkeller and I did some digging, and they've summarised our findings over here (but let's keep the discussion of it to this PR) #57419 (comment). |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #57595 +/- ##
==========================================
- Coverage 90.24% 90.23% -0.01%
==========================================
Files 630 630
Lines 185129 185129
Branches 36238 36233 -5
==========================================
- Hits 167064 167046 -18
- Misses 11045 11049 +4
- Partials 7020 7034 +14 🚀 New features to boost your workflow:
|
@@ -1,6 +0,0 @@ | |||
import('node:test').then((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.
can we add tests for both require and import in cjs?
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.
There is already in this PR, no?
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.
I might be missing it but where is there a cjs test with import?
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.
OH, sorry I think I misunderstood. You want
node --import global.cjs test.js
node --require global.cjs test.js // this exists
node --import global.mjs test.js // this exists
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.
Done (and the import CJS case passes): 6a38d32
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.
@MoLow 👀
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.
@JakobJingleheimer if nobody precedes me, I'll take a look ASAP.
The
--import
ed /--require
d file contained an un-await
ed dynamic import, so it's subsequent code was not guaranteed to finish before the entry-point starts. Strangely that should have caused this test to fail some times, but it seems to be consistently fast enough so that the race condition doesn't occur.I checked with the original author of the test, and this was not intended (it was only done that way in an attempt to simplify setup and recycle fixtures).
However, after speed improvements in #57419, the race condition was exposed and does occur consistently (causing the global hooks to get registered out of their intended/expected sequence).