ShopperCove
Menu
All writingBlogTopicsCategoriesAboutRSS
Blog
Categories
Observability & SRE62All categories
About

Plate 21

  1. Blog

Vitest 5.0.3 vs 4.1.10: Should You Upgrade? (20-File Timing)

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.

Aditya Challa·5 October 2026·4 min read

Summary
On this page
  1. Should you upgrade to Vitest 5?
  2. What I measured (ShopperCove box)
  3. clearMocks default (confirmed)
  4. Breaking-change checklist (skim before `pnpm up`)
  5. Bottom line
  6. Sources
  7. Related

No affiliate links. On 5 Oct 2026 (Asia/Calcutta) I timed the same 20-file / 40-test suite under pool: 'forks' on Node 22.20.0: Vitest 5.0.3 median wall clock ~512 ms vs Vitest 4.1.10 median ~547 ms (three warm runs each). That is the upgrade decision number for small unit suites—plus the hard engine gate (Node ^22.12.0 || ^24 || ≥26, peer Vite ≥6.4).

Should you upgrade to Vitest 5?

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.

What I measured (ShopperCove box)

Identical fixtures: twenty utilN.ts + utilN.test.ts pairs, vitest.config.ts with pool: 'forks', no isolation change, no coverage.

RunnerNodeRun 1Run 2Run 3Median
Vitest 4.1.10 + Vite 6.4.022.20.0547 ms598 ms530 ms~547 ms
Vitest 5.0.3 + Vite 6.4.022.20.0528 ms512 ms482 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.

clearMocks default (confirmed)

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.

Breaking-change checklist (skim before pnpm up)

  1. Node ≥ 22.12 and Vite ≥ 6.4 (Yarn users: add vite explicitly—it is a peer now).
  2. clearMocks: true by default—fix order-dependent mock history.
  3. Unawaited .resolves / .rejects / toMatchFileSnapshot fail the test (no more soft warn).
  4. vi.mock / vi.hoisted outside top level now throw.
  5. Inline projects inherit root config (extends defaults true) and may share the Vite server.
  6. Browser / reporter artifact paths moved under .vitest/; UI needs the printed auth token.
  7. Bench API: bench is a test-context fixture, not a top-level import.

Official detail: Vitest 5 blog and Migration Guide.

Bottom line

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.

Sources

  • https://vitest.dev/blog/vitest-5.html
  • https://vitest.dev/guide/migration.html
  • https://www.npmjs.com/package/vitest
  • https://github.com/vitest-dev/vitest/releases
  • https://github.com/vitest-dev/benchmarks
  • https://vitest.dev/guide/
  • https://vite.dev/
  • https://nodejs.org/en/blog/release

Related

  • https://www.shoppercove.com/blog/vite-8-3-2-renderbuilturl-bundled-dev-sourcemaps-october-2026
  • https://www.shoppercove.com/blog/vite-plus-1-0-unified-toolchain-october-2026
  • https://www.shoppercove.com/blog/playwright-1-63-test-locks-october-2026
  • https://www.shoppercove.com/blog/oxlint-1-87-react-suggestions-a11y-fixes-october-2026
  • https://www.shoppercove.com/blog/pnpm-12-9-1-rust-rewrite-wasm-split-october-2026
  • https://www.shoppercove.com/blog/bun-1-4-2-elysia-als-cmyk-jpeg-october-2026
  • https://www.shoppercove.com/blog/eslint-10-12-release-october-2026
  • https://www.shoppercove.com/blog/typescript-eslint-8-71-no-unsafe-enum-assignment-october-2026
vitestunit testingnode.jsviteperformancemigrationtesting tools

Lab evidence

What I found running this

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.

Notes when a lab post goes up

Occasional email for new hands-on reviews. No sequence and no sponsors.

Related links

  • Plate 25

    Should You Leave Jest for Vitest? 2.0s vs 1.3s

    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.

    5 Oct 2026

  • Plate 68

    pnpm vs npm vs Bun: Which Installs Fastest? 14s, 3.1s, 1.5s

    npm 12.2.0 vs pnpm 12.9.1 vs Bun 1.4.2 on one 24-dependency React + Vite app: from scratch 14.2 s / 3.1 s / 1.5 s; lockfile + warm cache 2.9 s / 0.28 s / 0.27 s; lockfile + empty cache 3.9 s / 2.3 s / 0.45 s. Disk, lockfile size and the pnpm phantom-dependency catch.

    5 Oct 2026

  • Plate 24

    SvelteKit 3 Is Here (Oct 1, 2026): Migration Checklist for Teams

    3 Oct 2026

On this page

  1. Should you upgrade to Vitest 5?
  2. What I measured (ShopperCove box)
  3. clearMocks default (confirmed)
  4. Breaking-change checklist (skim before `pnpm up`)
  5. Bottom line
  6. Sources
  7. Related
All writingBlogCategoriesTopicsAboutPrivacyRSS

© 2026 ShopperCove