vitest 5 keeps Jest's API and inherits your Vite config
Next generation testing framework powered by Vite.
At a glance
- What is it?
- vitest is a testing framework that runs on Vite's own config, transformers, resolvers and plugins, with Chai assertions and Jest-compatible expect, mocks, stubs, spies and snapshots. Version 5 requires Vite 6.4 or newer and Node 22.12 or newer, and it adds browser mode, type-level testing with expect-type, sharding and benchmarking.
- Who is it for?
- vitest fits a Vite project whose test suite should share the application's transform pipeline, and a team that wants Jest's assertion and mocking API without Jest's runner. It does not fit a Node project with no Vite, because the engine is Vite and version 5 requires Vite 6.4 or newer.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 2 days ago.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- vitest-dev/vitest17,378 ★ · +240
| Repository | 2026-09-21 | 2026-11-15 |
|---|---|---|
| vitest-dev/vitest | 17.1k | 17.4k |
240 Stars in the last 55 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The API is Jest's on purpose, and the engine is Vite's
The first feature line says it plainly: vitest uses Vite's config, transformers, resolvers and plugins, so you get the same setup as your app. The assertion layer is separate, and it is deliberately familiar. Chai is built in for assertions, with Jest expect compatible APIs, snapshots follow the Jest format, and mocking, stubbing and spies are described as Jest-compatible. The credits section says the same thing in the other direction, thanking the Jest team and community for creating the testing API, crediting one developer for the work on uvu that the project drew on, and another for the idea and implementation of using Vite to transform and bundle the server code. A suite looks like this, and the README runs it with npx vitest:
import { assert, describe, expect, it } from 'vitest'
describe('suite name', () => {
it('foo', () => {
expect(1 + 1).toEqual(2)
expect(true).to.be.true
})So migrating from Jest is mostly a change of runner, and the risk is the familiar one: a Jest behaviour you depended on that vitest does not implement is where you will discover it, and compatibility is an aim rather than a guarantee.
The test run inherits your app's plugins, and that is the trade
Sharing the transform pipeline is the whole argument for the framework, and it is worth being precise about what you inherit. The same config, transformers, resolvers and plugins that build your application also process your tests, which is why TypeScript and JSX work out of the box and why ESM and top level await are the default rather than an option. The other side of the same decision is that there is no separate test pipeline to configure and therefore no separate one to narrow. If your application config carries a plugin that assumes a browser, an alias that only resolves at runtime in the app, or an environment-specific transform, the test run gets it too, and the failure appears in your test command rather than in your build. Projects support exists for carving the configuration up, and the examples include one for it, which is the escape hatch to reach for when a single shared config stops working.
The file says Node 22.12, the manifest allows three release lines
The requirements line in the file is short: vitest requires Vite v6.4.0 or newer and Node v22.12.0 or newer. The manifest is narrower and more precise. The engines field reads a caret on 22.12, a caret on 24, and greater than or equal to 26, which in practice means three supported lines and not the continuous range the file describes. Node 23 and Node 25 satisfy the sentence in the file and are excluded by the manifest. That gap only matters if your package manager enforces engines strictly, and if it does you get an error rather than a warning on an odd-numbered release. The practical advice is dull and correct: run a test suite on an even-numbered Node, and read the manifest when you set up a version matrix, because the prose in a readme is where floors drift.
Two coverage engines, and they do not measure the same thing
Code coverage is described as native, with a choice of two providers, v8 or istanbul. The word native is doing work in that sentence, because the two get their numbers in different places. V8 coverage comes from the runtime's own instrumentation of what actually executed, while Istanbul instruments at transform time and knows about code paths it saw rather than code paths it ran. For the same test run the two can report different percentages and different uncovered lines, and code that only executes in a branch the transform saw but the test did not reach is counted differently by each. That makes a coverage threshold fragile in a way people discover when they switch providers. The other consequence is a reporting one, since a coverage number without its engine attached is not comparable to any other number, so record which one you use in the config and in whatever the CI job reports.
jsdom and Browser Mode are different answers to the same question
The file offers DOM testing in two forms and they are not interchangeable. JSDOM and happy-dom are listed for DOM and browser API mocking, which means the test runs in Node against an emulation of the browser. Browser Mode is listed separately, for running component tests in the browser, with example projects for Vue, React, Svelte, Lit and Marko. An emulated document has no layout engine, so anything that depends on real geometry, real focus order, real intersection observers or an actual paint is not being tested, however convincing the passing assertion looks. Browser Mode runs the component where it will live, which is why it exists and why it is a separate mode rather than a flag. The cost is time and a real browser in the loop, and the project's own scripts show it: the main CI run filters out the browser package and runs the rest sequentially, with the end-to-end and coverage runs as their own jobs.
The project's own loop runs threads first and browsers later
The scripts are the most honest description of how the project itself is tested. The plain test script does not run everything, it filters to the unit package and runs it in threads mode. The CI script then runs the test packages sequentially with the browser package filtered out, and there are separate scripts for the end-to-end tests and for coverage, plus a variant of the CI run that does not bail on the first failure. The aggregate ci script chains typecheck, lint, build and the CI test run in that order, so a formatting or lint failure stops the run before any test executes. Two more details are worth copying. The development script raises the Node heap to eight gigabytes before running the packages in parallel, which tells you what the build of a monorepo like this costs. And linting is two tools, oxlint and oxfmt, with an unused-export checker run under a flag that turns configuration hints into errors.
Sharding, projects and type-level tests are the features you outgrow last
The long tail of the feature list is where a framework stops being a runner. Sharding support matters when a suite no longer fits on one machine. Projects let you define several configurations with different include patterns and environments, which is how a monorepo stops arguing with itself about which tests belong where. expect-type adds type-level testing, so a type error is a failing test rather than something a compiler notices in a different command. Benchmarking is built in through Tinybench, so a performance regression can live next to the correctness test. Reporting uncaught errors and filtering, timeouts and concurrency for both suites and individual tests are the smaller entries that remove real friction. The examples directory is a fair map of the surface, with projects, typecheck, in-source-test, opentelemetry, profiling, fastify and basic as separate projects, and the licence is MIT held by VoidZero and the contributors since 2021.
Editorial conclusion
vitest fits a Vite project whose test suite should share the application's transform pipeline, and a team that wants Jest's assertion and mocking API without Jest's runner. It does not fit a Node project with no Vite, because the engine is Vite and version 5 requires Vite 6.4 or newer. Before you adopt it, check your Node version against the manifest rather than against the file, since the file states a floor of 22.12 while the engines field allows only 22.12, 24 and 26 or newer, which leaves the odd-numbered releases out. Then choose one coverage engine, v8 or istanbul, and write it into the config, because the two do not produce the same number for the same run. And decide early whether DOM tests run in jsdom or in Browser Mode, since only the second exercises real layout, which is also why the project's own CI runs its browser package as a separate step.
Frequently asked questions
What is Vitest used for?
It is a testing framework for JavaScript and TypeScript that runs on Vite's config, transformers, resolvers and plugins. It provides Chai assertions with Jest-compatible expect, snapshots, mocks, stubs and spies, watch mode, coverage through v8 or istanbul, a browser mode, benchmarking and sharding.
Why vitest instead of Jest?
The project's stated reason is the engine, since vitest uses Vite's config, transformers, resolvers and plugins so the test run shares the application's setup. The API stays familiar, with Jest-compatible expect, mocking, stubbing, spies and snapshots, and the credits thank the Jest team for creating that API.
What is the difference between Vite and Vitest?
Vite is the build tool; vitest is the test runner that runs on top of it. The project credits one contributor with the idea and implementation of using Vite to transform and bundle the server code, and the features list names Vite's config, transformers, resolvers and plugins as what vitest reuses.
how to use vitest
Import describe, it, expect and assert from vitest, describe your suites, and assert with expect or Chai's assert, with snapshots through toMatchSnapshot. The README shows running it with npx vitest, and vitest 5 requires Vite 6.4 or newer and Node 22.12 or newer.
how to install vitest
The file's own example runs the runner directly with npx vitest rather than showing an install command. What it does state is the requirement: Vite v6.4.0 or newer and Node v22.12.0 or newer, with the manifest allowing Node 22.12, 24, or 26 and newer.
how to use vitest coverage
Coverage is built in and comes in two flavours, v8 and istanbul, described as native code coverage. Pick one rather than leaving it to the default if you care about the number, because the two providers do not report the same percentages for the same run.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/vitest-dev-vitest)Star history chart for your README
[](https://hysenlabs.com/projects/vitest-dev-vitest)Was this useful?