Vitest 2 vs. bun test / node:test
Vitest vs. bun test vs. node:test · built-ins finally caught up
For three years vitest was the obvious answer. In 2026 the built-in runners (bun test, node:test) are good enough that the choice is no longer reflex.
option AVitest 2option Bbun test / node:testserviceWebsite & online shop
→ Verdict
We still default to Vitest 2 for any non-trivial codebase · the watch UX, snapshot ergonomics, browser mode, and `vi` mocking surface are unmatched. Pick bun test when you already run on Bun and want a single binary for install + test + run · it is fast, vitest-API-compatible, and removes a dev-dependency. Pick node:test when you publish a library or work in an environment where adding any test dependency is a fight · it is boring, stable, and exactly the right amount of feature for that job.
Pick a topic
When to pick which
A · Pick this when…
Vitest 2
- 01Apps with non-trivial mocking, fixtures, and snapshot needs
- 02You want a slick watch UI + Vitest UI for triage
- 03Component or browser-mode tests (Vitest browser provider)
- 04Coverage with v8 + custom reporters that the org expects
- 05You share a Vite config between dev and test
B · Pick that when…
bun test / node:test
- 01bun test: project already on Bun, you want zero dev-deps
- 02bun test: you need 2-5× faster cold runs on small suites
- 03node:test: shipping a public npm library, allergic to deps
- 04node:test: minimal CI image, runs anywhere Node runs
- 05node:test: you do not need fancy mocking or snapshots
Factors to weigh
Factor-by-factor
| Factors to weigh | Vitest 2 | bun test / node:test |
|---|---|---|
| Setup cost | One dep (`vitest`) + 5-line config | Zero · ships with the runtime |
| Cold-run speed (small suite) | Vitest: ~600-1200ms | bun test: ~100-300ms · node:test: ~300-600ms |
| Watch / HMR | Best-in-class · partial reruns by graph | bun test: solid `--watch` · node:test: `--watch` works, no UI |
| Mocking | `vi.mock`, hoisted, batteries-included | bun test: `mock()` close to vitest · node:test: `mock` API is barebones |
| Snapshots | Inline + file, with diffing | bun test: supported · node:test: file only, plain |
| Browser / DOM mode | First-class via `vitest browser` | Not built-in |
| Cross-runtime portability | Runs on Node, Bun, Deno (compat) | bun test: Bun-only · node:test: Node-only (also runs in Bun) |
| We recommend | Default for application code in 2026 | bun test for Bun-native apps · node:test for libraries |
Let's get started.
Send an email or book a 30-minute call.