Istanbul logo

Istanbul

Open Source

JavaScript code coverage tool that instruments ES2015+ source and generates detailed coverage reports.

Visit websiteGitHub

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

Easy

Maintenance

Low

Learning

Beginner

Licence

Free / Open source

// 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

ToolChoose it when
CodecovYou want to visualise/gate the coverage istanbul produces.
CoverallsYou want a coverage-reporting service for the output.
pytestYou want Python coverage via pytest-cov instead.

// 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

  1. Install nyc (Istanbul)

  2. Run tests through nyc

  3. Produce coverage (HTML/lcov/JSON)

  4. Enforce thresholds locally

  5. Upload lcov to a reporting service

  6. Keep thresholds meaningful

// RELATED QA.CODES RESOURCES