Vitest is a test runner built on Vite with Jest-like APIs. It targets frontend and backend JavaScript and TypeScript, with watch mode tied to the dev graph.
Overview
Vitest is a testing framework that uses Vite for transformation and bundling of test code. It was created so Vite application projects can run tests with the same resolve and plugin setup as the app, though it can also run outside a Vite app for backend code.
Feature areas include a watch mode that re-runs only affected tests, Jest-compatible expectations with mocking and spies, browser mode for component tests, multi-project workspaces, native ESM and top-level await, TypeScript and JSX support, filtering and timeouts, concurrent suites, sharding, and reporting uncaught errors. Migration from Jest is straightforward for common patterns like snapshots and coverage.
Vitest depends on recent Vite and Node versions. It stays relatively lightweight compared with older JS test stacks because it reuses Vite’s pipeline rather than maintaining a separate compiler path.
Vitest is installed as a dev dependency and invoked from the command line in local or CI environments. It is not a hosted testing service; runners execute wherever your project runs.
Key features
- Vite-config-aware test transforms
- Jest-compatible expect and mocks
- Incremental watch mode reruns
- Browser mode for components
- ESM, TypeScript, and JSX support
- Concurrent tests and suite sharding
- Multi-project workspace support
- Snapshot and coverage workflows
Use cases
- Unit tests in Vite Vue or React apps
- Backend TypeScript test suites
- Migrating Jest suites toward Vite
- Component tests in real browsers