test: allow onTestFinished() and expect.assertions() in concurrent tests #29238
Claude / Claude Code Review
completed
Apr 12, 2026 in 26m 11s
Code review found 2 important issues
Found 5 candidates, confirmed 4. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 2 |
| 🟡 Nit | 0 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🔴 Important | src/bun.js/test/bun_test.zig:77-94 |
expect.zig error messages still say concurrent tests unsupported after fix |
| 🔴 Important | src/bun.js/test/bun_test.zig:424-437 |
expect.assertions() count not incremented for post-await expect() in concurrent tests |
Annotations
Check failure on line 94 in src/bun.js/test/bun_test.zig
claude / Claude Code Review
expect.zig error messages still say concurrent tests unsupported after fix
The error messages in `expect.zig` for `expect.hasAssertions()` (line ~1185) and `expect.assertions()` (line ~1222) still say 'not supported in concurrent tests', which is now factually wrong — both functions work in concurrent tests when called synchronously before the first `await`. The PR updated the equivalent messages in `bun_test.zig` lines 88-91 to say 'call it synchronously before the first `await`', but missed these two in `expect.zig`, so a user calling either function after an `await`
Check failure on line 437 in src/bun.js/test/bun_test.zig
claude / Claude Code Review
expect.assertions() count not incremented for post-await expect() in concurrent tests
When expect.assertions(n) is called synchronously in a concurrent async test (now allowed by this PR) but the matching expect() matchers are called after an await, those matchers silently increment the global assertion counter instead of the per-sequence counter, causing the test to fail with 'expected N assertions, but test ended with 0 assertions' even though the assertions ran. This false failure is a new failure mode introduced by this PR: before it, expect.assertions() threw immediately in
Loading