test_runner: wait for filtered suite build - #64208
Conversation
|
Review requested:
|
3db8275 to
55f1419
Compare
This part sounds to me like something an LLM would write, and it doesn't really make a lot of sense to me. if the binary is old, |
|
@atlowChemi You're right, and I'm sorry about that verification note — it was misleading. I shouldn't have written that the old binary was "incompatible" and left the change unverified. The actual local blocker was a toolchain issue (the Apple clang / Command Line Tools Having actually run it now: you're correct that this change deadlocks. But while verifying, I found the deadlock is not specific to filtering — it reproduces with no name pattern at all: // repro.mjs
import test from 'node:test';
await test('t', async () => {});The hang is a circular wait in the
So fixing this in |
Signed-off-by: semimikoh <ejffjeosms@gmail.com>
The fixture used top-level `await test.suite()`, which deadlocks under --test-isolation=none independently of this change: runFiles() only calls finishBootstrap() after the import loop, while startSubtestAfterBootstrap() awaits bootstrapPromise, so module evaluation and bootstrap wait on each other. That made the new test time out on every CI platform. Cover the actual regression instead: a nested suite that is filtered out by name while its build is still pending. Nested suites bypass startSubtestAfterBootstrap(), so without the Suite#filteredRun change their late-registered subtest fails with parentAlreadyFinished. Signed-off-by: semimikoh <ejffjeosms@gmail.com>
55f1419 to
a610e7a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #64208 +/- ##
==========================================
+ Coverage 90.13% 90.14% +0.01%
==========================================
Files 741 744 +3
Lines 242106 242523 +417
Branches 45551 45697 +146
==========================================
+ Hits 218211 218620 +409
+ Misses 15430 15390 -40
- Partials 8465 8513 +48
🚀 New features to boost your workflow:
|
|
@MoLow @avivkeller The |
1 similar comment
|
Landed in 853358e |
Problem
When a filtered
Suitehas an async body, it can still be building itschildren when the filtered run path calls
postRun(). If the suite bodyuses
await test(...), the filtered child can be registered after thesuite is already being cleaned up, causing the child to be cancelled.
That leaves the run with no reported test failures, but a non-zero exit
code due to the cancelled test.
Fix
Make
Suite#filteredRun()wait forbuildSuitebefore delegating to thebase filtered run implementation. This keeps filtered suites from being
cleaned up while their async body is still registering children.
Test
Adds a regression fixture with awaited suites and awaited tests, then runs
it with
--test --test-isolation=none --test-name-pattern=C. The testasserts the run exits successfully and does not report any cancelled tests.
Verification
$ git diff --cached --checkThe full regression test was not completed locally because the existing
out/Release/nodebinary in this checkout isv22.22.2-preand is notcompatible with the current
maintest suite; the existingtest-runner-no-isolation-filteringcases fail with status 9 before thischange can be validated.
Fixes: #64203