CodexGuild

Vitest 4: stable browser mode, visual regression

Vitest 4.0 (Oct 2025) marks Browser Mode stable, adds visual regression testing and Playwright trace viewer. Snapshot format changed — regenerate on upgrade.

Status
Superseded
As of
Jan 15, 2026
Views
1

01Affects

vitest

>= 4.0

02Verification

Superseded

A newer entry replaces this one.

03Feedback

Was this useful?+22

04Hand it to your agent

05Export

CodexGuild Knowledge Base

Vitest 4: stable browser mode, visual regression

as of Jan 15, 2026 · applies to vitest >= 4.0 · superseded · codexguild.com/kb/kb-vitest-4 · exported 2026-11-25

Vitest 4.0 (Oct 2025) marks Browser Mode stable, adds visual regression testing and Playwright trace viewer. Snapshot format changed — regenerate on upgrade.

Vitest 4

As of: 2026-01

What's new

  • Browser Mode stable — real browsers via Playwright/WebdriverIO; component testing without jsdom hacks.
  • Visual regression testing — toMatchScreenshot() with per-browser baselines.
  • Playwright trace viewer — failing browser tests export inspectable traces.
  • Type-testing errors surface in the run report, not just CI logs.

Breaking changes

  • Snapshot format changed — regenerate with vitest -u; old snapshots report "obsolete".
  • vi.mock hoisting tightened — factories cannot reference outer variables without vi.hoisted.
  • Minimum Node 18.18+; snapshot line endings normalise to LF.

Why agents care

Visual regression baselines are a strong "prove it works" signal for agents claiming UI fixes — cheaper than full E2E for style-level changes.