JavaScript & TypeScript · Comparison
Vitest coverage: V8 vs Istanbul
Compare Vitest's V8 and Istanbul coverage providers, set up source coverage, and see when MC/DC and assertion coverage add useful evidence.
V8 vs Istanbul: which provider should you use?
Start with V8 on Node.js or Chromium. Use Istanbul when your test environment cannot expose V8 coverage, such as Firefox. Both are Vitest coverage providers—not alternative test runners.
Modern Vitest uses AST-based remapping for V8 coverage. Since Vitest 3.2, its reports match Istanbul’s coverage semantics. The old advice that Istanbul is always more accurate is no longer a good reason to switch. This is specific to Vitest, not every V8-based tool. See the official provider comparison.
Set up Vitest coverage
For an existing Vitest project, install the matching version of its coverage package, then run:
npm install -D @vitest/coverage-v8
npx vitest run --coverage
Include your source directory so files that no test imports still appear in the report:
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
coverage: {
provider: 'v8',
include: ['src/**/*.{js,ts,jsx,tsx}'],
},
},
});
To try Istanbul, install @vitest/coverage-istanbul and change provider to 'istanbul'. Keep the source scope and tests unchanged when comparing results.
What a green report can miss
Consider a session check:
function canAccess(signedIn, expired) {
if (signedIn && !expired) return true;
return false;
}
expect(canAccess(true, false)).toBe(true);
expect(canAccess(false, false)).toBe(false);
Both return paths run. But neither test checks an expired, signed-in session. The missing case is canAccess(true, true).
In our small JavaScript fixture, Vitest 5.0.0’s V8 and Istanbul providers both reported 100% line and branch coverage. Supercov 0.0.46 reported one of two independent conditions covered. Adding the expiry test brought that to two of two. This demonstrates a difference between coverage criteria, not a general accuracy ranking.
When to add Supercov
Keep Vitest for running tests. Its standard coverage is useful for finding unexecuted code. Add Supercov when you also need independent-condition gaps, individual test attribution, or a review of what assertions check.
| Feature | Vitest · V85.0.0 | Vitest · Istanbul5.0.0 | Supercov0.0.47 |
|---|---|---|---|
| Line coverage | Supported | Supported | Supported |
| Branch coverage | Supported | Supported | Supported |
| MC/DC | Not built in | Not built in | Supported |
| Per-test coverage | Not built in | Not built in | Supported |
| Assertion coverage | Not built in | Not built in | Supported |
✓ Supported · × Not built in. Standard coverage workflows in the versions shown; custom plugins are outside this table.
Vitest uses its standard V8 or Istanbul coverage provider here. Supercov works with your existing test runner.
Per-test coverage means individual tests, not just test files. Supercov needs a supported runner. Assertion coverage links source to checked properties through agent review; it is not a mutation score or a correctness guarantee.
npx supercov -- npx vitest run
npx supercov runs latest gaps
MC/DC asks whether each condition can change the decision. Assertion coverage asks which executed statements contribute to a property a test checks. Your agent reviews the recorded evidence; a mapping is not proof that an assertion would catch every bug.
See the assertion coverage example or choose between Vitest and Jest if you are still deciding on a runner.
Example evidence: fixture source and recorded results (JSON). Measured September 13, 2026. These small examples are not a performance benchmark or a general conformance test.