gitmyhub

istanbul

JavaScript ★ 8.7k updated 1y ago ▣ archived

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.

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.

JavaScriptNode.jssetup: easycomplexity 2/5

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.

Where it fits