IBRAVRA Media Network
Software Reviews • 12 min read

Vitest vs Jest vs Mocha: The Test Runner Playbook — Install Size, Speed & CI Minutes

All three test runners are free, so the choice is time, not price: the measured install trees, the parallel and serial architectures, and the CI-minutes math at 0.006 dollars a Linux minute.

By Enow A. Jovial • Published 2026-11-20

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

CapabilityVitest 5.1.1Jest 30.5.2Mocha 12.0.3
Transform pipelineVite dev server, esbuild, shares vite.config.jsBabel via babel-jest, or ts-jest for TypeScriptNone built in; the engineer wires a transpiler
Parallel executionWorker threads, parallel by defaultParallel workers across test filesSerial execution, one file at a time
AssertionsBuilt-in expect, Jest-compatible APIBuilt-in expectBring your own: Node assert, Chai
MockingBuilt-in vi.mock, Jest-compatibleBuilt-in jest.fn and jest.mockBring your own: Sinon
SnapshotsBuilt inBuilt inNot built in
CoverageBuilt in via @vitest/coverage-v8 or IstanbulBuilt inBring your own: nyc, c8
Watch modeEnabled by defaultAvailable with --watchAvailable with --watch
Browser testingBrowser mode built inNot built in; jsdom is a separate packageRuns in the browser natively
ConfigurationZero config on a Vite projectZero config for plain JavaScript; Babel config for TypeScriptMinimal config; composition is the configuration
Authorityvitest.dev guide, November 2026jestjs.io getting started, November 2026mochajs.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.

RunnerVersionFull install treePackages in the tree
Vitest5.1.140,011,903 bytes32
Jest30.5.236,572,522 bytes186
Mocha12.0.311,254,183 bytes25

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.

Mocha share=11,254,18340,011,903=0.281\text{Mocha share} = \frac{11,254,183}{40,011,903} = 0.281

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.

Vitest's own guide: some ports have seen test running an order of magnitude faster
Vitest's own guide: some ports have seen test running an order of magnitude faster

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.

Monthly cost=Minutes per run×Runs per month×0.006\text{Monthly cost} = \text{Minutes per run} \times \text{Runs per month} \times 0.006
Included minutes=120.006=2,000\text{Included minutes} = \frac{12}{0.006} = 2,000

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.

GitHub Actions billing: Linux 2-core runners at 0.006 dollars per minute, macOS at 0.062 dollars
GitHub Actions billing: Linux 2-core runners at 0.006 dollars per minute, macOS at 0.062 dollars

The decision matrix

Project situationPickWhy
Vite application, new projectVitestOne pipeline, zero config, Jest-compatible API
React application on Webpack or Babel, large existing Jest suiteJestThe suite passes; migration costs more than the speed gain
Plain Node service, no bundler, small suiteMocha11.25 MB install, serial runs that are easy to debug
Tests must run in a real browserMocha or Vitest browser modeMocha runs in the browser; Vitest ships a browser mode
Team wants one command and no assemblyJestAssertions, mocking, snapshots, coverage in the install
Team wants each piece replaceableMochaChai, Sinon, and c8 are swappable
Suite over 30 minutes in CI on a private repoMeasure first, then decideA 3x faster suite saves 432 dollars a year at 200 runs a month
Authorityvitest.dev, jestjs.io, mochajs.org, docs.github.comAll 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.

Do not migrate a passing suite on a speed claim you have not measured. Run the team's own suite on the candidate runner, on the same machine, three times, and take the median. A runner that is faster on one codebase can be slower on another: a suite dominated by transform time favors Vitest, a suite dominated by database setup favors no runner at all, and a suite that depends on Jest's module registry internals may not run on Vitest without changes.

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.

All three runners are free, so the comparison is about time, not price. Mocha is the lightest install at 11.25 MB and 25 packages. Vitest is the heaviest tree at 40.01 MB and the fastest by design, with a Vite-native pipeline and parallel worker threads. Jest is the most complete out of the box, with 186 packages behind one command.

Founder & CEO Insight — Enow A. Jovial

"The runner is not the product. The tests are the product, and the runner is the tool that runs them. Pick the runner that disappears: the one whose configuration you never think about, whose failures you can read, and whose bill you never notice."
— Enow A. Jovial, Founder & Chief Executive Officer

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.
Step 1: clone the repository into a scratch directory and install the candidate runner alone. Step 2: run the suite three times and record the median. Step 3: multiply the median by the monthly run count and by 0.006 dollars, and compare with the current runner's bill.

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.