API Reference

c8

Istanbul-compatible code coverage built on Node.js V8 coverage, with low overhead and no transpilation.

Official Documentation ↗
CompatibilityThis documentation covers version v12.0.0. Check the official docs for the latest API surface.

Installation

npmnpm install --save-dev c8

Methods

c8 runs your command while collecting V8 coverage, then produces Istanbul reporters and threshold checks.

Key Features

  • V8 native coverage without instrumentation
  • Istanbul reporters such as text and html
  • Threshold enforcement via check-coverage

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/bcoe/c8@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:48:38.634Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

FAQ

Do I need to instrument my code?
No. c8 reads the V8 coverage that Node emits itself, so there is no babel plugin or istanbul instrumentation step.
Does c8 work with TypeScript?
Yes for compiled output, but for precise source mapping run the TypeScript test runner through something like tsx so line numbers map back to the .ts files.
How do I exclude files?
Use --exclude or --exclude-after-remap with glob patterns, and --all to include files that were never imported.