vitest
Next generation testing framework powered by Vite
Jest works well but has a major friction point in Vite projects: Vite uses native ES modules and Vite-specific transforms (e.g. CSS modules, SVG imports), while Jest uses CommonJS and its own transform pipeline. Getting them to agree requires complex configuration. Vitest runs inside Vite's pipeline so your test environment matches your app environment exactly.
Vitest is Jest's API running inside Vite. If you know Jest (describe, it, expect, vi.mock), you know Vitest. The key difference is that Vitest uses Vite's config and transforms โ the same aliases, plugins, and module resolution in your tests as in your app. No separate babel or jest.config to maintain.
Install vitest
npm install vitest
import { } from 'vitest';Use it when
Use Vitest for any Vite-based project (React, Vue, Svelte) that needs unit or integration tests. It's also a good Jest replacement in non-Vite Node projects that want faster test execution and native ES module support.
Skip it when
For Next.js projects, Jest is still the recommended and better-documented choice. Vitest's browser mode (for running tests in a real browser) is still maturing โ for end-to-end browser tests, use Playwright or Cypress.
Ready to explore the full API?
See every class, function, and relationship in an interactive graph.