Vitest 5 upgrade decision with ShopperCove timing: 20-file forks suite median ~512 ms on 5.0.3 vs ~547 ms on 4.1.10 (Node 22.20.0). Engines require Node 22.12+ and Vite 6.4+. clearMocks defaults true. No affiliate.
4 min read
Vitest 5 is worth upgrading to if you already run Node 22.12+ (or 24/26) and Vite 6.4+: on the same 20-file, 40-test forks suite, Vitest 5.0.3 had a median of about 512 ms against about 547 ms on 4.1.10 (about 6% faster). Stay on 4 until you can raise Node and Vite, and check tests that rely on mock call history, because clearMocks now defaults to true.
Yes if you already run Node 22.12+ (or 24 / 26) and Vite 6.4+, want the Vitest 5 performance work (shared Vite server for inline projects, stable fsModuleCache, faster vm pools / Browser Mode), and can absorb migration defaults like clearMocks: true. Wait if you are still on Node 20, cannot bump Vite yet, or your suite relies on mock call history leaking across tests without an explicit reset.
npm’s current line is vitest@5.0.3 (modified 2026-09-30T11:30:42Z / ~17:00 IST). The 5.0.0 blog line landed 3 Sep 2026.
Identical fixtures: twenty utilN.ts + utilN.test.ts pairs, vitest.config.ts with pool: 'forks', no isolation change, no coverage.
| Runner | Node | Run 1 | Run 2 | Run 3 | Median |
|---|---|---|---|---|---|
| Vitest 4.1.10 + Vite 6.4.0 | 22.20.0 | 547 ms | 598 ms | 530 ms | ~547 ms |
| Vitest 5.0.3 + Vite 6.4.0 | 22.20.0 | 528 ms | 512 ms | 482 ms | ~512 ms |
On this tiny suite the win is modest (~6%). Vitest’s own benchmarks write-up shows much larger drops on heavier apps (for example their deps-heavy vmThreads cell 1.59 s → 0.74 s, about −53%). Treat our number as a local smoke cost, not a claim that every monorepo will see 50% cuts.
package.json engines on 5.0.3: node: '^22.12.0 \|\| ^24.0.0 \|\| >=26.0.0'. Peer vite: ^6.4.0 \|\| ^7.0.0 \|\| ^8.0.0. On this box Node 20.19.2 still executed vitest run for 5.0.3 (40/40 pass), but that is unsupported—migrate Node before you rely on 5 in CI.
I ran a two-test module where a module-scoped vi.fn() is called in test A, then asserted to have 0 calls at the start of test B. On 5.0.3 that assertion passed—matching the migration note that clearMocks defaults to true (vi.clearAllMocks() before each test). If you depended on cross-test call history, set clearMocks: false or move spies into beforeEach.
pnpm up)vite explicitly—it is a peer now).clearMocks: true by default—fix order-dependent mock history..resolves / .rejects / toMatchFileSnapshot fail the test (no more soft warn).vi.mock / vi.hoisted outside top level now throw.extends defaults true) and may share the Vite server..vitest/; UI needs the printed auth token.bench is a test-context fixture, not a top-level import.Official detail: Vitest 5 blog and Migration Guide.
Should you upgrade? If you already meet the Node/Vite floor, Vitest 5 is the supported line—our 20-file median ~512 ms vs ~547 ms is a small green light, and the real wins show up on larger / vm / browser suites in Vitest’s own tables. If you are on Node 20, upgrade Node first; do not treat an accidental green run on unsupported Node as production-ready. No affiliate.
On this small 20-file suite, slightly: median ~512 ms on 5.0.3 vs ~547 ms on 4.1.10. Vitest's own benchmarks show bigger drops on heavier projects, such as 1.59 s to 0.74 s in one vmThreads case.
Node ^22.12.0, ^24.0.0 or >=26.0.0, with Vite ^6.4.0, ^7 or ^8 as a peer. It ran on Node 20.19.2 in this test, but that setup is unsupported.
clearMocks defaults to true, unawaited .resolves/.rejects and toMatchFileSnapshot now fail tests, vi.mock and vi.hoisted outside top level throw, and bench becomes a test-context fixture.
Lab evidence
Sources read 5 Oct 2026 evening (Asia/Calcutta): vitest.dev/blog/vitest-5.html (3 Sep 2026); vitest.dev/guide/migration.html (Node >=22.12, Vite >=6.4; clearMocks default true; unawaited async asserts fail). npm vitest latest=5.0.3 time.modified 2026-09-30T11:30:42.795Z (~17:00 IST); 5.0.0 published 2026-09-03T12:24:30.312Z. package engines node '^22.12.0 || ^24.0.0 || >=26.0.0'; peer vite '^6.4.0 || ^7.0.0 || ^8.0.0'. Hands-on on box Node 22.20.0: identical 20-file/40-test forks suite — Vitest 4.1.10 (pnpm) warm medians 547/598/530 ms → median ~547 ms; Vitest 5.0.3 warm 528/512/482 ms → median ~512 ms. clearMocks fixture: module-scoped vi.fn() call count cleared between tests on 5.0.3 (2/2 pass). Node 20.19.2 still ran vitest 5.0.3 (unsupported). No ShopperCove production suite changed. No affiliate.
Explore the product
Untested by us. Check what's included, the license and refund terms before you buy.
bun test 1.4.2 vs Vitest 5.0.3 on 300 TypeScript tests in 60 files: warm wall medians 136 ms vs 1,673 ms (~12x); Vitest --no-isolate 765 ms (~5.6x). A 5-file vitest-API check (vi.fn, vi.mock, fake timers, spyOn, it.each, snapshot) passed 7/7 under Bun.
Hands-on6 Oct 20265 min read
Jest 30.5.2 vs Vitest 5.0.3 on 40 files / 200 Node tests: wall medians Jest 2027 ms, Vitest isolate-on 2422 ms, Vitest --no-isolate 1287 ms, Jest --runInBand 3346 ms. Both 200/200 pass. Leave Jest after measuring isolate; default isolate can lose.
Summary5 Oct 20265 min read
Hands-on6 Oct 20269 min read