Skip to content

bun:test: bound expect() promise waits by the test timeout - #36716

Open
robobun wants to merge 6 commits into
mainfrom
claude/farm/3130629c/expect-resolves-timeout
Open

bun:test: bound expect() promise waits by the test timeout#36716
robobun wants to merge 6 commits into
mainfrom
claude/farm/3130629c/expect-resolves-timeout

collapse doc comment to one line

ad31381
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Aug 1, 2026 in 26m 31s

Code review found 1 important issue

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

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/runtime/test_runner/expect.rs:934-941 Timed-out toThrow() promise not marked handled — later rejection leaks as unhandled

Annotations

Check failure on line 941 in src/runtime/test_runner/expect.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Timed-out toThrow() promise not marked handled — later rejection leaks as unhandled

The `still_pending` early return here bypasses `promise.unwrap(..., MarkHandled)` at line 942 without a prior `set_handled`, so a promise that rejects *after* the deadline surfaces as an unhandled rejection during the next test. The other two sites this PR modifies (`process_promise` ~L520, `execute_custom_matcher` ~L1532) both call `promise.set_handled(vm)` before waiting; add `promise.set_handled(global_this.vm())` here too, before or inside the `still_pending` branch.