Devii · Testing · 2026-03-07 · 6 min read

Share

Vitest: Unit Tests Aligned With Vite's Transform Pipeline

Jest-compatible APIs with native ESM, watch mode, and shared config with your Vite app.

**Vitest** is a test runner built for Vite projects. It reuses Vite's transform pipeline so tests import the same modules as dev server code, including TypeScript, JSX, and aliases from `vite.config.ts`.

API surface mirrors **Jest** (`describe`, `it`, `expect`) with `vi` for mocks. `happy-dom` or `jsdom` provide browser-like environments for component tests.

Coverage report
Coverage report

Configure `test.globals` and `coverage` thresholds in CI. Use `pool: 'forks'` or threads per docs for stability with native modules.

Official site: `vitest.dev`. For React, pair with Testing Library; for Vue, `@vue/test-utils`. Pin Vitest major to your Vite major.