Cloud Parts

Vitest

A test runner for JavaScript and TypeScript built on Vite, with a Jest-compatible API, watch mode on by default and a browser mode that runs tests in a real browser.

What it is
Automated testing (test runners)
Type
Open source
Made by
Vitest team (VoidZero, now part of Cloudflare)
License
MIT
Facts checked
9 October 2026

What it is

Vitest sends test files through the same Vite pipeline and vite.config as the app, so TypeScript, JSX and ES modules work without a second build setup, and the app’s Vite plugins and aliases apply to tests too. It runs test files in parallel, each in its own child process by default (the forks pool) or in a worker thread, and isolates each file’s environment. Tests inside a file run one after another unless marked concurrent. Started without arguments, vitest watches in development and runs once in CI (when process.env.CI is set); in watch mode it follows the module graph and reruns only the tests that import a changed file.

The API copies Jest’s: describe, it and expect (built on Chai, with Jest-compatible matchers), vi.fn() and vi.mock() for mocks, Jest-compatible snapshots, and coverage through V8 or Istanbul. Browser code can run against a simulated DOM (jsdom or happy-dom) or, in Browser Mode, in a real browser driven by Playwright or WebdriverIO; Browser Mode lost its experimental label in Vitest 4.0 (October 2025). Vitest 5.0 (September 2026) focused on speed, cutting one 1,280-module benchmark app from 7.24 s to 5.83 s, and added a Trace View that replays each browser test step by step.

Vitest has its own core team, from several companies. VoidZero, the company Evan You started in 2023 to build a unified toolchain around Vite, employs or sponsors several core contributors. VoidZero joined Cloudflare in June 2026, saying Vite, Vitest, Rolldown and Oxc stay open source under MIT and that its team keeps leading them.

Why teams pick it

  • One pipeline: tests reuse the app’s Vite config, plugins and aliases instead of a separate Babel or ts-jest setup
  • Jest-compatible API, so most Jest suites move over with few changes
  • Fast feedback: files run in parallel, and watch mode reruns only the tests a change affects
  • Browser Mode runs the same tests in a real browser through Playwright or WebdriverIO, and Storybook builds its component testing on it

Watch out for

  • jsdom and happy-dom only simulate a browser, so a test can pass there and fail in a real one; Browser Mode fixes that but starts slower
  • Browser Mode isn’t an end-to-end tool: the docs recommend pairing it with Playwright, Cypress or WebdriverIO for full user flows
  • Fast major cadence (1.0 in December 2023, then 2.0, 3.0, 4.0 and 5.0 by September 2026), each with breaking changes; 5.0 alone turns on clearMocks by default and removes test.sequential
  • concurrent tests share their file’s worker, so it only speeds up tests that wait on I/O; synchronous tests still run one after another

How it fits with other technologies

A test file with a mock, run once with `npx vitest run` · ts

// price.ts
export function total(items: { price: number; qty: number }[], coupon?: string): number {
  const sum = items.reduce((s, i) => s + i.price * i.qty, 0);
  return coupon === "TEN" ? Math.round(sum * 0.9 * 100) / 100 : sum;
}

// price.test.ts
import { describe, expect, it, vi } from "vitest";
import { total } from "./price";

describe("total", () => {
  it("adds price times quantity", () => {
    expect(total([{ price: 2.5, qty: 4 }, { price: 1, qty: 3 }])).toBe(13);
  });

  it("takes 10% off with the TEN coupon", () => {
    expect(total([{ price: 20, qty: 1 }], "TEN")).toBe(18);
  });

  it("mocks a function and checks the call", () => {
    const send = vi.fn();
    send(total([{ price: 5, qty: 2 }]));
    expect(send).toHaveBeenCalledWith(10);
  });
});

// $ npx vitest run --reporter=verbose
//  ✓ price.test.ts > total > adds price times quantity 1ms
//  ✓ price.test.ts > total > takes 10% off with the TEN coupon 0ms
//  ✓ price.test.ts > total > mocks a function and checks the call 1ms
//  Test Files  1 passed (1)
//       Tests  3 passed (3)

See it in a real stack

No architecture uses Vitest yet. Drop it into the playground and wire it up yourself.Open playground →
Where it came from2021–2026

Vite’s plugins and integrations had built a busy ecosystem around its dev server and builds, but its unit-testing story wasn’t clear. Jest, the dominant runner, was created in a different context: a Vite project had to configure two separate transform pipelines, one for the app and one for its tests. The Vitest docs put the idea simply: use the Vite dev server to transform files during testing, and the runner can skip all that work and focus on the testing experience.

Anthony Fu made the first commit to Vitest on 3 December 2021, and snapshot support landed the same day. The README credits the Jest team for the API it copied and Patak (@patak-dev) for the name. Version 0.1.0 followed in January 2022 and 1.0 in December 2023.

In October 2024 Evan You announced VoidZero, a company building a unified JavaScript toolchain around Vite, with a team that included Vitest’s creators and core contributors; Vitest’s team-based governance stayed as it was. Vitest 4.0 (October 2025) made Browser Mode stable, and Vitest 5.0 (September 2026) concentrated on performance. In June 2026 VoidZero joined Cloudflare, with its projects staying MIT-licensed.

Why it’s built this way

Reuse Vite’s transform pipeline
Running tests through the same config and plugins as the app removes the duplicated setup that Jest needed in Vite projects.
Copy Jest’s API
Jest was massively adopted, so a compatible API let Vitest be a drop-in replacement in most projects instead of asking teams to rewrite their tests.
Watch mode by default
Vite pushes a development-first experience; rerunning only the tests a change touches, the way hot module replacement updates only the changed module, keeps that loop fast.
Run tests in a real browser too
Simulated DOMs such as jsdom can disagree with real browsers and give false positives or negatives, so Browser Mode runs tests natively in a browser.

Timeline

  1. 2021

    Anthony Fu makes the first commit (December)

  2. 2022

    Version 0.1.0 released (January)

  3. 2023

    Vitest 1.0 (December)

  4. 2024

    Evan You announces VoidZero, which employs core Vitest contributors (October)

  5. 2025

    Vitest 4.0 makes Browser Mode stable (October)

  6. 2026

    VoidZero joins Cloudflare (June); Vitest 5.0 (September)

Sources15 · facts checked 9 October 2026

Improve this page on GitHub