LogoTrendingDevTools
icon of Vitest

Vitest

Vitest is a fast, Vite-native testing framework for JavaScript and TypeScript with a Jest-compatible API, browser mode, coverage and watch mode.

Visit Website

Introduction

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.

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

  1. Install it with npm install -D vitest.
  2. Create a file such as sum.test.ts and write a test with expect.
  3. Add "test": "vitest" to your package.json scripts.
  4. Run npm run test to start watch mode.
  5. 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.

ℹ️

Affiliate Disclosure: TrendingDevTools may earn a commission if you sign up through links on this page, at no extra cost to you.

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates