What is Vitest?
Vitest is an open-source test runner built on top of Vite. It reuses your Vite config, plugins and transforms, so tests understand the same TypeScript, JSX and module setup as your app with little extra configuration. Its API is compatible with Jest, which makes migrating easy, and its smart watch mode reruns only the tests affected by a change. Vitest works in Vite projects and can also be used on its own.
Key features
- Vite-powered: shares your app's config and plugins, with native ESM and TypeScript support.
- Jest-compatible API:
describe,it,expect, mocks and snapshots work the way Jest users expect. - Smart watch mode: reruns only affected tests, similar to hot module replacement.
- Browser Mode: run tests in real browsers through providers such as Playwright.
- Coverage: built-in support for V8 or Istanbul coverage.
- UI: an optional web UI to browse and debug tests.
- Workspaces and projects: run multiple configurations in one repo.
- Type testing and benchmarks: test types and run performance benchmarks.
Who is it for?
Vitest is for frontend and full-stack JavaScript and TypeScript developers, especially those using Vite, Vue, React, Svelte, Astro or Nuxt, and for teams who want faster tests than older tools provide. Because it shares the Vite pipeline, there is usually no separate Babel or ts-jest setup to maintain, which removes a common source of configuration drift between tests and the app.
Use cases
- Unit tests for libraries and utilities
- Component tests for React, Vue and Svelte apps
- Running tests in real browsers with Browser Mode
- Migrating an existing Jest test suite
- Monorepos with several test configurations
Pricing
Vitest is free and open source under the MIT license. Read the official guide to get started.
What's new and trending
Vitest 5 is now the current major version. Vitest 5.0.5 was released on October 15, 2026, alongside a 4.1.12 maintenance release, and v5.1.0-beta.1 followed on October 19, 2026 (release notes).
Getting started
- Install it with
npm install -D vitest. - Create a file such as
sum.test.tsand write a test withexpect. - Add
"test": "vitest"to yourpackage.jsonscripts. - Run
npm run testto start watch mode. - Add a
vitest.config.ts(or use your Vite config) for coverage and environments.
Alternatives
Jest is the long-established JavaScript test runner, and Bun includes its own Jest-compatible runner. For end-to-end tests, see Playwright and Cypress, and for mocking APIs, Mock Service Worker. Vitest is built on Vite.
FAQ
Is Vitest free? Yes. Vitest is open source under the MIT license.
Do I need Vite to use Vitest? No, though Vite projects benefit most because the config is shared.
Can I migrate from Jest? Yes. Vitest's API is largely Jest-compatible, and the docs include a migration guide.
Does Vitest run tests in a real browser? Yes, with Browser Mode using a provider such as Playwright.
Does Vitest support code coverage? Yes, through V8 or Istanbul providers.

