Repository navigation
Conversation
When --bail hits its threshold, handle_test_completed was calling Global::exit(1) directly from inside on_sequence_completed, which skips every remaining group in the execution order, including the afterAll hooks for describe scopes that were already on the stack. Servers, temp directories, and other fixtures started in beforeAll were leaked on every bailed run. Instead of exiting in place, latch the bail on the Execution and let step_group finish the file: each ConcurrentGroup now records the group index where its enclosing describe scope begins and whether it holds afterAll entries, so once bail fires the step loops can skip every remaining test/beforeAll group and run only the afterAll groups whose scope_start is at or before the group where bail fired (the scopes already entered). step_sequence_one drops not-yet-run test sequences in the current group so concurrent groups settle without starting new tests. The summary line and "Bailed out after N failures" message move to TestCommand::run, after the file's afterAll unwind completes. Fixes #12250
|
Updated 11:26 PM PT - Jul 24th, 2026
❌ @robobun, your commit aea35d9 has some failures in 🧪 To try this PR locally: bunx bun-pr 35504That installs a local version of the PR into your bun-35504 --bun |
|
Warning Review limit reached
Next review available in: 10 seconds Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
Comment |
|
Found 1 issue this PR may fix:
🤖 Generated with Claude Code |
|
Re #32183: this moves the bail exit past the file's completion (so |
A concurrent test whose beforeEach/body already ran should still run its afterEach chain and reach on_sequence_completed; gate the bail drop on active_entry == first_entry so only sequences that have not started at all are discarded.
|
CI on build 80022: all five failures are tagged
The new |
|
Closing as part of a cleanup of stale pull requests. This PR has had no new commits since 2026-07-25, it conflicts with main, and its last CI run failed. This is not a judgment on the fix itself. The linked issue (#12250) stays open. If the problem still reproduces on a current build, reopen this PR after a rebase or open a new one against main. |
Fixes #12250.
Problem
bun test --bailexits viaGlobal::exit(1)directly from the per-test result callback (CommandLineReporter::handle_test_completed), which skips every remaining execution group including theafterAllhooks for describe scopes that were already on the stack. Only the failing test'safterEachfires; servers, temp directories, and other fixtures started inbeforeAllare leaked on every bailed run.Jest's
--bailfinishes the current file including allafterAllhooks (it bails between files only).Fix
Instead of exiting in place, latch the bail on the
Executionand letstep_groupfinish the file:ConcurrentGroupnow recordsscope_start(the group index where its enclosing describe scope begins) andis_after_all, populated during order generation.summary.fail == bail,handle_test_completedsetsreporter.bailed = trueandexecution.bail_at_group = Some(group_index)instead of exiting.bail_at_groupis set,step_groupskips every group that is not anafterAllwhosescope_start <= bail_at_group(i.e. only the scopes already entered when bail fired get their teardown).step_sequence_onedrops not-yet-run test sequences in the current group so concurrent groups settle without starting new tests.Bailed out after N failuresmessage move toTestCommand::run, printed after the file'safterAllunwind completes, thenGlobal::exit(1)as before.With the fix the example above now prints
AFTEREACH,DESCRIBE-AFTERALL,ROOT-AFTERALL, then the bail message, and still exits 1 having run only the one failing test.afterAllfor sibling describes that had not started yet does not run.Verification
Existing
--bail, hook, describe, and concurrent suites pass unchanged.no test proof · iteration 0 · Platform-specific test(s) that do not run on this machine. Deferring to CI, which covers all platforms: test/cli/test/bun-test.test.ts
Not covered here
Two narrow same-class cases are intentionally left for a follow-up; neither is a regression (pre-PR ran zero
afterAllunder--bail):afterAllin serial multi-file runs: anafterAllregistered from a--preloadscript is only scheduled into the last file's execution order (gated onfirst_last.last). When bail fires in an earlier file the loop inrun_all_testsnever reaches the last file, so the preloadafterAllstill does not run.--isolateand--parallelare unaffected (every file islastthere). Covering this needs a different mechanism than the per-file unwind built here.test.concurrentmerged across a describe boundary: when a nested describe with nobeforeAllstarts withtest.concurrentimmediately after an outertest.concurrent, the nested test merges into the outer group, so the nestedafterAll'sscope_startexceeds the merged group index and the unwind predicate skips it. Breaking the merge at describe entry regresses the documented concurrent ordering (concurrent.fixture.ts), so this is left as-is.