Claude Opus 5.5

vitest-5-0-0-15-b

Claude Code's read-only tools, web search on, ludion sync off

Question

Can expect.poll hang my Vitest test forever if the callback never settles?

Answer key

A correct answer says
expect.poll fails when the polled function does not resolve within the timeout.
The stale answer
expect.poll keeps waiting on a function that never resolves.

Answer

**Probably not forever, but `expect.poll`'s own `timeout` may not be what stops it.** I'm going from memory of the Vitest source here and didn't check your installed version.

- **Why the poll timeout may not fire:** `expect.poll` awaits your callback on each attempt. In the implementation I remember, when the poll `timeout` (default 1000 ms) expires, it makes one last call to the callback and waits for that to settle. If the promise never settles, the poll can stall instead of failing with "Matcher did not succeed in time." Newer versions may handle this differently.
- **What still stops it:** the test-level timeout (`testTimeout`, default 5000 ms, or the timeout you pass to `it`) fails the test. It only truly hangs if you've turned that off with `0` or a very large value.
- **How to avoid it:** make the callback settle on its own, for example with an `AbortSignal.timeout(...)` on fetches, or by racing it against a short timer.

Answering cost $0.07.

Grade

wrong

The judge's reason: It says the poll can stall on a never-settling callback instead of failing at the poll timeout, which is the stale behavior; it only hedges that newer versions may differ.

The judge's log

Session log

What the agent wrote, the tools it called, and what they returned, from docs/bench/2026-10-11-done3/runs/B-project/vitest-5-0-0-15-b.jsonl. Thinking and the session's settings are left out. The raw log

  1. Agent

    **Probably not forever, but `expect.poll`'s own `timeout` may not be what stops it.** I'm going from memory of the Vitest source here and didn't check your installed version.
    
    - **Why the poll timeout may not fire:** `expect.poll` awaits your callback on each attempt. In the implementation I remember, when the poll `timeout` (default 1000 ms) expires, it makes one last call to the callback and waits for that to settle. If the promise never settles, the poll can stall instead of failing with "Matcher did not succeed in time." Newer versions may handle this differently.
    - **What still stops it:** the test-level timeout (`testTimeout`, default 5000 ms, or the timeout you pass to `it`) fails the test. It only truly hangs if you've turned that off with `0` or a very large value.
    - **How to avoid it:** make the callback settle on its own, for example with an `AbortSignal.timeout(...)` on fetches, or by racing it against a short timer.