Logic Foundry

Build with understanding.

Vitest 5 prioritizes speed and tightens test defaults

Originally reported by InfoQ on November 17, 2026.

VoidZero has released Vitest 5.0, a major update to the Vite-based test runner that emphasizes performance while changing several long-standing test defaults.

In benchmarks covering projects from a five-file utility package to a 1,280-module monolithic application, the Vitest team reported speed gains of roughly 8%–25% in most configurations and up to 53% with VM pools. VoidZero attributed the improvements to inline projects sharing one Vite server, a stable on-disk fsModuleCache, fewer round trips between the main process and workers, and reusable compiled code in VM pools. The new vitest doctor command reruns a test suite under different configurations and recommends faster options; the reported gains are not a guarantee for every project.

Browser Mode gains a built-in Trace View that records interactions and assertions as DOM snapshots for step-by-step playback. The new vi.when API lets a single listener return different values for different arguments.

Migration may require test and CI changes: clearMocks now defaults to true; unawaited asynchronous assertions fail instead of producing a warning; hoisted vi.mock calls outside top-level scope throw errors; and toThrow('') now matches any error. OpenReplay, cited by InfoQ, warned that tests relying on mock call history leaking between tests could fail in CI despite passing locally under Vitest 4.

Vitest 5 requires Vite 6.4 and Node.js 22.12 or later. Yarn users must install Vite themselves because it is now a peer dependency. Reports, attachments and blob reports have moved to .vitest/, so CI artifact paths may need updating. Compatibility work was still ongoing at the time of InfoQ’s report: a Cloudflare vitest-pool-workers issue said its peer dependency range remained pinned to Vitest 4, potentially preventing projects using the newer version from running tests.