Skip to content

bun test: drain the event loop for script files with no test() registrations - #34862

Open
robobun wants to merge 15 commits into
mainfrom
claude/farm/14b6b439/test-drain-script-files
Open

bun test: drain the event loop for script files with no test() registrations#34862
robobun wants to merge 15 commits into
mainfrom
claude/farm/14b6b439/test-drain-script-files

Gate the drain on bare hook scopes and bound it by the test timeout

2c76198
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 21, 2026 in 35m 25s

Code review found 1 potential issue

Found 4 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/runtime/cli/test_command.rs:3251-3252 Drain deadline reads raw default_timeout_ms, ignoring 0=unlimited and setDefaultTimeout() override

Annotations

Check warning on line 3252 in src/runtime/cli/test_command.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Drain deadline reads raw default_timeout_ms, ignoring 0=unlimited and setDefaultTimeout() override

The deadline reads `reporter.jest.default_timeout_ms` directly, which diverges from the effective-timeout precedence tests actually use (`ScopeFunctions.rs:740-747`: per-test option → `default_timeout_override` → `default_timeout_ms`, with **0 = unlimited**). With `--timeout=0` (accepted by `Arguments.rs:1562` and treated as unlimited elsewhere), `deadline == now` so `.is_lt()` is false on the first check and the drain body never runs — defeating the fix. Separately, a preload calling `setDefaul