test: allow onTestFinished() and expect.assertions() in concurrent tests #29238
Claude / Claude Code Review
completed
May 6, 2026 in 31m 55s
Code review found 1 potential issue
Found 6 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | src/test_runner/bun_test.zig:393-399 |
onTestFinished() can silently attach to the wrong concurrent sequence via cross-test microtask drain |
Annotations
Check warning on line 399 in src/test_runner/bun_test.zig
claude / Claude Code Review
onTestFinished() can silently attach to the wrong concurrent sequence via cross-test microtask drain
Edge case worth noting: because `runCallbackWithResultAndForcefullyDrainMicrotasks` drains the *global* microtask queue while one sequence's entry is on `current_callback_stack`, a concurrent test that resolves a promise another concurrent test is awaiting can cause that other test's continuation (and its `onTestFinished()` call) to run inside the wrong sequence's push/pop window — silently attaching the hook to the sibling test instead of throwing as it did before this PR. This requires deliber
Loading