Migrating to Vitest v5.0.0-beta.4
Version v5.0.0-beta.4 introduces 4 breaking changes. This guide details how to update your code.
Released: 6/1/2026
⚠️ Check Your Code
If you use any of these symbols, you need to read this guide:
toHaveTextContenttoMatchTextContentbenchmark APIlocators.exactvi.defineHelperForceRerunTriggersdisableConsoleInterceptcdp APIallowWriteallowExecBreaking Changes
●Issue #1
Throw an error if hoistable methods are outside the top level scope. Ensure hoistable methods are defined at the top level.
●Issue #2
`toHaveTextContent` is now strict; use `toMatchTextContent` if you require non-strict matching.
●Issue #3
The public API for the `benchmark` feature has been rewritten. Review usage of benchmark-related functions.
●Issue #4
In browser mode, `locators.exact` is now enabled by default. This may change locator behavior if it was previously relying on inexact matching.
Migration Steps
- 1If you relied on `toHaveTextContent` for non-strict matching, replace calls with `toMatchTextContent`.
- 2Review and update any usage of the `benchmark` public API due to its rewrite.
Release Summary
This release introduces new features like trace view steps in the browser and HTML reporter single file output, alongside several breaking changes affecting hoistable methods and assertion strictness. Numerous bug fixes address issues across browser, UI, and mocking functionalities.
Need More Details?
View the full release notes and all changes for Vitest v5.0.0-beta.4.
View Full Changelog