JavaScriptTypeScript VitestVite Automated TestingTest AutomationSoftware Testing 1 min read

Vitest 5.1.0 Adds Test Isolation Flags and Browser Mode Enhancements

Vitest 5.1.0 introduces test isolation flags, improved browser mode tracing, expanded fake timer support, and various coverage and cache optimizations.

Vitest 5.1.0 dropped on 2 November with --last-failed and --since-last-run flags to isolate test execution, alongside a fix ensuring setup files rerun after --changed filtering and deleted-file imports trigger runs.

You can now interactively review failed snapshots. Fake timers expand to cover node:timers and node:timers/promise, while vi.setSystemTime() takes Temporal.Instant and Temporal.ZonedDateTime. The experimental vi.waitFor and vi.waitUntil added a message option, retries and repeats expose individual results, and error logs surface specific attempts.

Browser mode received the biggest changes, featuring import map module mocking, an experimental pointer API, and an out-of-experimental trace view that captures aria snapshots. A failure-only trace mode is now default, printing a trace steps timeline in the terminal for failed tests and individual attempts. Node also got an experimental trace timeline. The default browser port shifted to 23315, meaning hard-coded configurations must update, while browser fixes address connection failures, page.viewport() hangs, and Edge handling in toHaveStyle.

Coverage providers can store data in the fs module cache, the V8 provider added an ignoreNode option, and Istanbul switched to magic-string with rolldown. Cache fixes handle concurrent clears and unwritable directories, and module caches key on the deps optimizer.