explaingit

gotwarlost/istanbul

8,669JavaScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

An archived JavaScript code coverage tool that tracked which lines, branches, and functions your tests actually ran, now replaced by the active istanbuljs packages at istanbuljs on GitHub.

Mindmap

mindmap
  root((Istanbul))
    What it does
      Code coverage
      Test gap detection
      Coverage reports
    Coverage Types
      Statement coverage
      Branch coverage
      Function coverage
    Outputs
      HTML report
      lcov file
      JSON data
    Status
      Archived
      Use istanbuljs
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Generate a color-coded HTML report showing which lines of code your tests cover.

USE CASE 2

Measure branch coverage to confirm that both sides of every if-else are exercised.

USE CASE 3

Export lcov-format coverage data to integrate with a CI tool or third-party dashboard.

Tech stack

JavaScriptNode.js

Getting it running

Difficulty · easy Time to first run · 5min

This repository is archived, use the current istanbuljs packages at github.com/istanbuljs instead.

In plain English

Istanbul is a JavaScript code coverage tool, which means it measures how much of your code is actually executed when you run your tests. When you write tests for a program, you might think they check everything, but in practice some lines or branches of code may never get touched during the test run. Istanbul instruments your code (adds tracking logic behind the scenes) and then produces a report showing exactly which statements, functions, and branches were run and which were not. This repository is archived and has been inactive for seven years. The README clearly states that this version is deprecated and directs users to the actively maintained replacement at the istanbuljs organization on GitHub and at istanbul.js.org. New projects should go there rather than use this version. For historical context, the original Istanbul worked by wrapping your node test command with a single prefix: instead of running your test file directly, you ran it under istanbul cover, and Istanbul would produce a coverage folder containing a JSON data file, an lcov file for tools that accept that format, and an HTML report you could open in a browser. The HTML report highlighted each source file and colored the covered lines green and the uncovered lines red. It supported statement coverage (was this line reached), branch coverage (when there was an if-else, was both the true and false path exercised), and function coverage (was this function ever called). It could also be used as a library from within other JavaScript tools, not just as a standalone command. Again, if you are looking to add coverage to a JavaScript project today, use the current istanbuljs packages rather than this archived repository. This repo is preserved for reference only.

Copy-paste prompts

Prompt 1
How do I run my Node.js tests with istanbul to get a coverage report, and where does the HTML output appear?
Prompt 2
Set up istanbul to enforce a minimum of 80% branch coverage and fail the build if the threshold is not met.
Prompt 3
Using istanbul as a library, instrument a JavaScript file programmatically and print a coverage summary to the console.
Prompt 4
How do I read an istanbul HTML coverage report to find which specific functions were never called during my test run?
Open on GitHub → Explain another repo

← gotwarlost on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.