type: service
status: active
timestamp: 2026-06-20
tags: [testing, unit, vitest, vite, ci, primary]

Vitest

Vite-native unit + integration test runner — free, OSS, fast

Vitest

Role

The family’s unit + integration test runner. Every Astro / React package or site already runs on Vite, so Vitest shares the dev config (path aliases, plugins, env loading) without a parallel jest.config.ts. Used for:

Free tier

Card / subscription required?

NO. OSS — installed via pnpm add -D vitest @vitest/ui.

How CI consumes it

- name: Unit tests
  run: pnpm vitest run --reporter=verbose --coverage

Coverage uploads to Sonarcloud via its coverage/lcov.info artefact — same wiring the code-quality stack already expects.

Alternatives

Swap cost

Low — Vitest’s API is Jest-compatible (describe / it / expect). A swap to Jest would be mechanical for the test files; the cost is re-introducing a parallel config tree.

Why this is our pick

Same engine as the dev server (Vite), so reload loops are fast, config is unified, and ESM-only packages just work. Free, OSS, unlimited. Pairs with Playwright for E2E + Storybook/Chromatic for visual regression — the three-layer testing stack.

Cross-refs


Edit on GitHub · Back to index