Vitest 4.0 adds Browser Mode, visual regression testing, and Playwright Traces support
Vitest 4.0 arrives as a major update to the Vite-native testing framework, introducing stable support for Browser Mode and several notable enhancements. With the experimental label removed, teams can now integrate Browser Mode into production workflows, though certain changes to the public API may require code adjustments.
Building on these updates, the release adds visual regression testing for Browser Mode. This feature enables developers to capture and compare UI screenshots against reference images, helping detect unexpected visual changes in components and pages.
In addition, Vitest 4 now offers Playwright Trace generation with traces available as annotations in test reporters. Users working with Playwright also benefit from the new page.frameLocator API, which makes it easier to find and interact with elements inside iframes. The Visual Studio Code extension gains a “Debug Test” button for browser tests, streamlining debugging directly from the code editor.
Developers using test.extend with lifecycle hooks such as beforeEach and afterEach can now reference these hooks directly on the returned test object. Another feature, expect.schemaMatching, allows assertions to validate values against Standard Schema v1 objects.
Other changes include exposing Chai's assert methods on expect for convenience, removing the basic reporter in favor of the default reporter with summary: false, and providing several new advanced public API methods alongside a few breaking changes.