Vitest 5.0 Beta Breaking Changes: Full Guide

A dark comparison-matrix style cover listing Vitest 5.0 beta's breaking changes across three groups: mocking (vi.mock scope, clearMocks default flip), config (projects inheritance, parent-directory lookup), and assertions (expect.poll, async awaits, toThrow(''))
On this page

Structural Comparison Matrix

#ChangeThrows or silent?Applies to you if…
1vi.mock top-level scope enforcementThrowsYou call vi.mock/vi.unmock/vi.hoisted inside a describe/test block
2clearMocks defaults to trueSilentAny suite that asserts on mock call counts across multiple tests
3test.sequential / describe.sequential removedThrows (removed API)You use either option instead of { concurrent: false }
4Config not found in parent directorySilent (CLI fails)You run vitest from a subdirectory relying on a parent config
5bench no longer a top-level exportThrows (removed API)You use Vitest’s benchmarking API
6Unawaited async assertions failThrowsYour suite has an expect(promise).resolves... without await
7expect.poll rejects on timeoutThrowsYou use expect.poll() to wait on an async condition
88 subpath entry points removedThrows (import error)You import from vitest/reporters, vitest/coverage, etc. directly
9toThrow('') matches any errorSilentAny test asserting toThrow('') expecting an empty-message-only match
10Inline projects inherit root configSilentYou use test.projects and relied on isolation from root config

Every row is confirmed against Vitest’s own migration guide, not summarized from memory. Full mechanism, exact error text where one exists, and the fix live in each linked post below.

The 10 changes, in detail

  1. Fix Vitest 5 vi.mock Top-Level Scope Error: vi.mock, vi.unmock, and vi.hoisted now throw if called outside module top level, instead of just warning.
  2. Fix Vitest 5 clearMocks Breaking Mock State: clearMocks flips to true by default, wiping mock call history before every test.
  3. Fix Vitest 5 test.sequential Removed Error: test.sequential/describe.sequential are gone; use { concurrent: false } instead.
  4. Fix Vitest 5 Config Not Found in Parent Directory: Vitest stops searching parent directories for a config file.
  5. Fix Vitest 5 bench No Longer Top-Level Export: benchmarks move inside test() as a context fixture; several benchmark.* config options are removed.
  6. Fix Vitest 5 Unawaited Async Assertion Error: a forgotten await on an async assertion now fails the test instead of just warning.
  7. Fix Vitest 5 expect.poll Timeout Error: expect.poll() actively rejects on timeout instead of letting a late result still pass.
  8. Fix Vitest 5 Cannot Find Module vitest/reporters: eight subpath entry points (vitest/reporters, vitest/coverage, and more) are removed outright.
  9. Fix Vitest 5 toThrow(”) Silently Passing Tests: an empty string is no longer special-cased, so it now matches any thrown error.
  10. Fix Vitest 5 Projects Not Inheriting Root Config: inline test.projects entries now inherit root Vite plugins and setupFiles by default.

Why cover a beta at all

Most pillars on this site cover a stable release most readers are already running. This one doesn’t, and that’s worth being upfront about rather than glossing over: Vitest 5.0 was still in beta (v5.0.0-beta.7, 2026-07-24) at the time this was researched, and this repo’s own test suite hasn’t upgraded past vitest@^3.0.0. The case for covering it anyway: the migration guide already documents 33 distinct breaking changes against a real, shipping beta, not a speculative RFC, and several of them (the mocking defaults especially) are exactly the kind of silent behavior change that’s worth knowing about before it surfaces as a confusing failure the week Vitest 5 goes stable and a dependency update pulls it in without anyone reading a changelog first.

If you’re evaluating whether to adopt the beta now versus wait for stable, that’s a real decision this guide doesn’t make for you - it only tries to make sure you’re not surprised by what’s actually in it either way.

Browse the rest of the Guides & Fixes archive for more framework and tooling breaking-change coverage.

Frequently asked

Do I need to fix all 10 of these before upgrading?

No. Two changes (vi.mock's top-level scope enforcement, and expect.poll's timeout behavior) throw a real error the moment you hit them. The rest are silent default-behavior or config-shape changes that only bite if your suite actually uses that specific feature - clearMocks and toThrow('') are the two most likely to change what a test reports without throwing anything, so check those two even if nothing else in this list looks familiar.

Is Vitest 5.0 stable yet?

No, not at the time this pillar was written. The latest release was v5.0.0-beta.7 (2026-07-24). Every post in this series is sourced to Vitest's own official migration guide and labeled honestly as covering pre-release software, not a stable version most projects are already running. This repo's own vitest.config.ts stays pinned to vitest@^3.0.0 and none of these changes were reproduced against this project's own test suite - treat every claim across this series as documented behavior from Vitest's primary source, not a first-party repro.

Emitted as FAQPage JSON-LD from the same frontmatter — one source, no duplicated prose.

Recent posts

Full-text search via Pagefind · ↑↓ to navigate · ↵ to open