Three runners, one decision, zero license fees
Vitest, Jest, and Mocha all cost nothing: every one of them is free and open source, and the license line in the budget is zero for all three. The cost that decides between them is time: the minutes a suite takes on every pull request, the hours an engineer spends configuring the runner, and the weeks a migration consumes when the wrong runner is chosen. This playbook compares the three on the facts that change those costs: how each one transforms code, how it parallelizes, what it includes, what it leaves out, and what a suite costs to run in continuous integration at stated volumes.
The three runners come from three eras. Mocha is the oldest, a flexible test framework for Node.js and the browser that runs tests serially and leaves assertions and mocking to libraries the engineer chooses. Jest is Meta's batteries-included runner, the default choice for React and large JavaScript codebases for a decade, with its own assertion library, mocking, snapshots, and coverage built in. Vitest is the newest, a Vite-native runner that reuses the Vite dev server to transform files during testing and runs tests in worker threads in parallel. Versions current on November 20, 2026: Vitest 5.1.1, Jest 30.5.2, Mocha 12.0.3, all read from the npm registry this cycle.
What each runner actually does
Vitest's design is one sentence: the test runner uses the same transformation pipeline as the application. Vite's dev and build story was strong, but its unit testing story was unclear, because Jest was created in a different context and forced two different pipelines. Vitest runs on the Vite dev server, needs no separate transform configuration, and takes the application's vite.config.js as its own configuration. Watch mode is enabled by default, and the runner uses worker threads to run as much as possible in parallel. The Vitest documentation states that some ports have seen test running an order of magnitude faster, and that Vitest provides a compatible API so it can be used as a drop-in replacement for Jest in most projects. The claim is Vitest's own, not a measurement made for this playbook, and it is attributed as such.
Jest's design is the opposite bet: one package that does everything. Install Jest, write a test, run jest, and the runner finds the tests, transforms the code with Babel, runs them in parallel workers, asserts with expect, mocks with jest.fn, snapshots with toMatchSnapshot, and reports coverage. The Jest documentation states plainly that Jest is not supported by Vite, because of incompatibilities with the Vite plugin system, and points Vite projects toward Vitest. For TypeScript, Jest transpiles through Babel or ts-jest, and Babel transpilation does not type-check tests as they run.
Mocha's design is the oldest bet: a small core that does one thing well. Mocha runs tests serially, maps uncaught exceptions to the correct test cases, and runs on Node.js and in the browser. It ships no assertion library, no mocking, and no snapshot testing. The engineer brings Chai for assertions, Sinon for spies and stubs, and nyc or c8 for coverage. That composition is a feature for teams that want each piece replaceable, and a tax for teams that want one command to set up. The three runners come from three eras, and the table below puts the differences in one place.
The architecture table
| Capability | Vitest 5.1.1 | Jest 30.5.2 | Mocha 12.0.3 |
|---|---|---|---|
| Transform pipeline | Vite dev server, esbuild, shares vite.config.js | Babel via babel-jest, or ts-jest for TypeScript | None built in; the engineer wires a transpiler |
| Parallel execution | Worker threads, parallel by default | Parallel workers across test files | Serial execution, one file at a time |
| Assertions | Built-in expect, Jest-compatible API | Built-in expect | Bring your own: Node assert, Chai |
| Mocking | Built-in vi.mock, Jest-compatible | Built-in jest.fn and jest.mock | Bring your own: Sinon |
| Snapshots | Built in | Built in | Not built in |
| Coverage | Built in via @vitest/coverage-v8 or Istanbul | Built in | Bring your own: nyc, c8 |
| Watch mode | Enabled by default | Available with --watch | Available with --watch |
| Browser testing | Browser mode built in | Not built in; jsdom is a separate package | Runs in the browser natively |
| Configuration | Zero config on a Vite project | Zero config for plain JavaScript; Babel config for TypeScript | Minimal config; composition is the configuration |
| Authority | vitest.dev guide, November 2026 | jestjs.io getting started, November 2026 | mochajs.org, November 2026 |
The table's sharpest row is the transform pipeline. A Vite project that chooses Jest configures two pipelines: Vite for the application and Babel for the tests. A Vite project that chooses Vitest configures one. A plain Node project with no bundler gets nothing from Vitest's Vite integration and pays for a dependency it does not use.
The install footprint, measured
The license is free, but the install is not weightless. On November 20, 2026, each runner was installed alone into an empty directory on this machine with npm install, and the resulting node_modules tree was measured with du. The numbers are the full dependency tree, not the single package.
| Runner | Version | Full install tree | Packages in the tree |
|---|---|---|---|
| Vitest | 5.1.1 | 40,011,903 bytes | 32 |
| Jest | 30.5.2 | 36,572,522 bytes | 186 |
| Mocha | 12.0.3 | 11,254,183 bytes | 25 |
Three findings follow. First, Mocha is the lightest install by a wide margin: 11,254,183 bytes is 28.1 percent of Vitest's 40,011,903 bytes, and its 25 packages are the fewest. Second, Vitest's tree is the heaviest in bytes, because it carries Vite and esbuild, and the Vitest package itself is 2,899,804 bytes unpacked. Third, Jest has the most packages by far, 186 against Vitest's 32, because its batteries-included design is assembled from many small packages, while the jest package itself is a 6,698 byte stub that pulls in jest-cli and the rest. The package count is the dependency audit surface: 186 packages means 186 entries in the lockfile.
The install footprint is a one-time cost on a developer machine and a repeated cost in CI, where the cache is cold more often than anyone admits. It is not the deciding factor, but the direction surprises people: the newest runner is not the lightest, and the batteries-included runner is not the heaviest in bytes, only in package count.
The CI minutes math
The recurring cost is compute minutes. GitHub Actions bills standard Linux 2-core runners at 0.006 dollars per minute, and the GitHub Free plan includes 12 dollars of compute usage per month. Standard runners are free in public repositories, so the math below applies to private repositories. The free plan's included 12 dollars buys 2,000 minutes a month on a Linux 2-core runner.
Scenario one is a small team. The suite takes 12 minutes per run, and the team runs it 60 times a month. The total is 720 minutes, and 720 times 0.006 equals 4.32 dollars, which sits inside the 12 dollar included allowance, so the out-of-pocket cost is zero. The runner choice changes nothing on the bill at this volume.
Scenario two is a busy monorepo. The suite takes 45 minutes per run, and the team runs it 200 times a month. The total is 9,000 minutes, and 9,000 times 0.006 equals 54.00 dollars. Subtract the 12 dollar included allowance and the bill is 42.00 dollars a month, or 504.00 dollars a year. Now suppose the same suite runs three times faster on a different runner, taking 15 minutes instead of 45. The total falls to 3,000 minutes, the cost falls to 18.00 dollars, and after the allowance the bill is 6.00 dollars a month, a saving of 432.00 dollars a year. The three-times-faster figure is a scenario, not a measurement: this playbook did not benchmark the runners, and no runner should be chosen on a speed claim without running the team's own suite on it.
The operating system dwarfs the runner. A macOS runner costs 0.062 dollars per minute, which is 10.3 times the Linux 2-core rate of 0.006 dollars. A 45 minute suite run 200 times a month on macOS costs 558.00 dollars before the allowance, against 54.00 dollars on Linux. A team that runs its suite on macOS because the tests need a Mac, and then argues about runner speed, is optimizing the wrong line. Windows 2-core runners cost 0.010 dollars per minute, and Linux 1-core slim runners cost 0.002 dollars per minute, one third of the standard Linux rate.
The decision matrix
| Project situation | Pick | Why |
|---|---|---|
| Vite application, new project | Vitest | One pipeline, zero config, Jest-compatible API |
| React application on Webpack or Babel, large existing Jest suite | Jest | The suite passes; migration costs more than the speed gain |
| Plain Node service, no bundler, small suite | Mocha | 11.25 MB install, serial runs that are easy to debug |
| Tests must run in a real browser | Mocha or Vitest browser mode | Mocha runs in the browser; Vitest ships a browser mode |
| Team wants one command and no assembly | Jest | Assertions, mocking, snapshots, coverage in the install |
| Team wants each piece replaceable | Mocha | Chai, Sinon, and c8 are swappable |
| Suite over 30 minutes in CI on a private repo | Measure first, then decide | A 3x faster suite saves 432 dollars a year at 200 runs a month |
| Authority | vitest.dev, jestjs.io, mochajs.org, docs.github.com | All figures read November 20, 2026 |
The migration costs are concrete. Jest to Vitest is the cheapest move: the API is compatible by design, and the work is the configuration file and the transform setup. Mocha to Vitest is a rewrite of the assertion layer: every Chai assertion and Sinon stub has to be translated or carried over, and the suite's serial assumptions have to be re-checked under parallel execution. Vitest to Jest means adding a Babel pipeline to a Vite project. Jest to Mocha is a stripping-down: the team gives up snapshots and built-in coverage and rebuilds the harness from parts.
Who should not switch
Do not switch if the suite is green and the team is shipping. A migration is a week of engineering time for a saving measured in minutes per run. Do not switch to Mocha for a large suite that needs snapshots and coverage, because rebuilding those from parts costs more than the install saves. Do not switch to Vitest for a project with no Vite dependency, because the Vite runtime becomes dead weight. Do not switch to Jest for a Vite project: the Jest documentation itself says Jest is not supported by Vite. Do not choose on install size alone: the difference between the heaviest and lightest tree is 28.76 MB.
The honest limitation of this comparison is that it contains no benchmark. Speed claims in runner marketing are measured on the vendor's suite, not yours. The install sizes are measured and the CI rates are published, but the number that decides the choice is the runtime of your suite on your machine.
Founder & CEO Insight — Enow A. Jovial
Execution checklist
- [x] Measure the suite first: run the current suite three times on the same machine and take the median runtime.
- [x] Measure the install: install each candidate alone in an empty directory and compare the full tree size and package count, not the single package size.
- [x] Price the CI volume: multiply minutes per run by runs per month by 0.006 dollars, subtract the 12 dollar included allowance.
- [x] Check the operating system: a macOS runner at 0.062 dollars a minute costs 10.3 times the Linux rate, and that difference dwarfs any runner speed gap.
- [x] Test the migration on a branch: port a slice of the suite, run it on the candidate runner, and count the broken tests before committing to the move.
- [x] Verify the API surface: confirm the mocking, snapshot, and coverage features the suite uses exist in the candidate runner, or budget the replacement.
- [x] Keep the old runner until the new one is green: run both in CI during the migration, and remove the old one only when the new suite passes three consecutive runs.
The end-to-end testing comparison sits beside this one: our Playwright vs Cypress vs Puppeteer playbook covers the browser testing trio with the same pricing math, and the desktop framework comparison is our Electron vs Tauri vs Neutralino playbook. Before you migrate, model the saving in our ROI calculator.

