SupercovCompare
← All comparisons

JavaScript & TypeScript · Comparison

Jest coverage: V8 vs Babel

Keep Babel, Jest's default, unless coverage is too slow or your code skips Babel. The two providers count differently: the same tests gave 100% and 82% lines.

Babel or V8: which provider should you use?

Keep Babel, Jest’s default, unless coverage makes your runs too slow or your code does not go through Babel. Choose V8 then. The two count different things, so expect the percentages to change when you switch.

coverageProvider accepts babel or v8. Babel rewrites your source with counters before it runs. V8 runs the code as it is, reads coverage from the engine and maps it back to your source.

Switch providers

npx jest --coverage --coverageProvider=v8

Or set it in your Jest configuration:

module.exports = {
  collectCoverageFrom: ['src/**/*.js'],
  coverageProvider: 'v8',
};

Set collectCoverageFrom with either provider. Without it, a file that no test imports is missing from the report instead of showing 0%.

Same tests, different percentages

We ran three passing tests against one 17-line file with each provider, on Jest 30.5.2 and Node.js 24.21.0:

ProviderLinesBranchesFunctions
Babel5/5 (100%)6/7 (85.71%)2/2 (100%)
V814/17 (82.35%)4/5 (80%)2/3 (66.66%)

Three things explain the gap:

  • Lines. Babel counts the lines that hold a statement. V8 counts every line of the file, blank lines and closing braces included.
  • Ignore comments. The file has /* istanbul ignore next */ above an untested function. Babel leaves that function out. V8 does not read the comment and reports the function as uncovered. V8 reads /* c8 ignore next 3 */ instead; with that comment the results swap to 17/17 lines for V8 and 5/6 for Babel.
  • Branches. Babel counts the if, each side of &&, the default parameter and both sides of the ternary. V8 counts the blocks the engine tracked.

A percentage that moves when you change provider says nothing about your tests. Reset your coverage thresholds when you switch.

What neither provider shows

Both reports mark if (signedIn && !expired) as fully covered, because the tests take the if both ways. No test tries a signed-in session that has expired. That is what MC/DC measures. Neither provider says which test ran a line.

What Supercov adds

npx supercov -- npx jest
npx supercov runs latest gaps

Supercov runs your own Jest command, with your configuration, setup files and reporters. On the same file it reported 7/9 lines, 4/6 branches and 1/3 MC/DC conditions, and named !expired as the condition no test showed changing the result. Coverage is recorded per test, parameterized tests included.

Using Vitest? See Vitest coverage: V8 vs Istanbul.

Example evidence: fixture source, commands and recorded results (JSON). Measured October 12, 2026 with Supercov 4.3.0. These small examples are not a performance benchmark or a general conformance test.