What problem does it solve?
Vitest reduces slow, brittle, and hard-to-configure test workflows by providing a Vite-powered test runner that runs tests quickly with native ESM and TypeScript support and a familiar Jest-like API.
Core Features & Use Cases
- Vite-native performance: Leverages Vite's transform pipeline and plugins for fast test execution and HMR-like updates during development.
- Jest-compatible API: Provides test, describe, expect, and vi mocking utilities so existing Jest suites can be migrated with minimal changes.
- TypeScript and ESM first: Supports native ESM, TypeScript, and JSX without additional bundling steps.
- Mocking, fixtures, and hooks: vi mocking utilities, test.extend fixtures, and lifecycle/around hooks for robust setup and teardown patterns.
- Coverage, snapshots, and filtering: Built-in coverage (V8 or Istanbul), snapshot testing, test filtering, sharding, and concurrent execution for CI and large monorepos.
- Use Case: Run unit and integration tests in a Vite-based frontend project, mock network calls, run type-only checks, and collect coverage reports in CI.
Quick Start
Run vitest to execute the project's tests with coverage enabled and use jsdom for browser-like tests.