Istanbul
JavaScript code coverage tool that instruments ES2015+ source and generates detailed coverage reports.
Pricing
Free / Open source
Type
Automation
Languages
JavaScript, TypeScript
// VERDICT
Reach for Istanbul/nyc when you want to measure JS/TS coverage locally and in CI, feeding the numbers to a reporting service if desired. Skip it when you're not in JS/TS or want a hosted platform rather than the generator.
Best for
The standard JavaScript code-coverage tool (via the nyc CLI) - instrumenting JS/TS to measure statement, branch, function and line coverage from your test runs.
Avoid when
You're not in JS/TS, you want a hosted reporting platform (that's Codecov/Coveralls), or coverage isn't tracked.
CI/CD fit
nyc CLI wraps test runs · lcov/json output · feeds Codecov/Coveralls
Languages
JavaScript · TypeScript
Team fit
JS/TS teams · Coverage measurement · Feeding coverage platforms
Setup
Maintenance
Learning
Licence
// BEST FOR
- Measuring JS/TS statement/branch/function/line coverage
- Wrapping any test run via the nyc CLI
- Producing lcov/JSON for reporting services
- Local HTML coverage reports
- Enforcing coverage thresholds
- The JS coverage standard
// AVOID WHEN
- You're not in JS/TS
- You want a hosted reporting platform (Codecov/Coveralls)
- Coverage isn't tracked
- A different language's coverage is needed
- You want only a dashboard, not the generator
- Minimal tooling is the goal
// QUICK START
npm install -D nyc
npx nyc npm test # outputs coverage (HTML/lcov); set thresholds; upload lcov to a service// ALTERNATIVES TO CONSIDER
// FEATURES
- Statement, branch, function, and line coverage metrics
- Source-map support for accurate ES2015+ and TypeScript coverage
- Multiple reporters: text, lcov, json, html, cobertura
- nyc CLI wrapper for Mocha, Tap, AVA, and others
- Coverage thresholds enforced as build gates
// PROS
- De facto standard for JS coverage outside Jest/Vitest
- Works with virtually any Node test runner
- lcov output integrates with every coverage SaaS
- Configurable thresholds catch regressions in CI
// CONS
- Minimal active development — basic feature set only
- Heavier setup than built-in Jest/Vitest coverage
- Branch coverage on async/generator-heavy code can be misleading
// EXAMPLE QA WORKFLOW
Install nyc (Istanbul)
Run tests through nyc
Produce coverage (HTML/lcov/JSON)
Enforce thresholds locally
Upload lcov to a reporting service
Keep thresholds meaningful