← Back to all briefs
Tooling57s read

Vitest 5.0 Breaks Existing Suites: clearMocks Flip, Failing Un-awaited Assertions, Node 22.12 Floor

Vitest 5.0.0 flips `clearMocks` to true, fails the un-awaited async assertions that used to pass silently, and raises the floor to Vite 6.4.0 and Node.js 22.12.0. The 53% vm-pool gain is the second beat, not the headline.

Vitest 5.0.0 breaks existing suites on bump day. clearMocks now defaults to true, un-awaited async assertions fail instead of passing silently, and the floor moves to Vite 6.4.0 and Node.js 22.12.0, which blocks CI images still on Node 20.

Un-awaited resolves, rejects, and toMatchFileSnapshot assertions were auto-awaited at the end of the test in Vitest 4 and now fail the run. vi.mock inside describe or test throws. Browser locators now match text exactly by default, so getByText('Item') stops matching Item 1. bench is no longer a top-level import, so bench files that import it from vitest stop running and need the test-context fixture instead.

Performance is the second beat, not the headline: a deps-heavy vmThreads suite drops 1.59s to 0.74s, 53% faster. If you run large isolated suites, the vm pool is where the gains live. Two new features earn their place. vi.when sets per-argument spy behavior where you otherwise stack mockImplementation calls and hope the last one wins. vitest doctor reruns your suite under alternative configurations and recommends what would make it faster.

Run your suite against 5.0.0 on a branch with Node 22.12 in CI before you bump, then search for un-awaited resolves and rejects calls and for browser text locators that relied on partial matching. If your CI image still sits on Node 20, fix that first, since it blocks everything else.