Skip to content

Using the CLI

Kitson Kelly edited this page Sep 28, 2015 · 2 revisions

When you install the package, the NodeJS package manager will place a command line interface in node_modules/.bin/remap-istanbul.

The command line interface understands the following argument flags:

Flag Description
-i or --input The path to the coverage input file. For example remap-istanbul --input coverage.json. If omitted, input will be taken from stdin.
-o or --output The path to the remapped coverage output file. For example remap-istanbul --output coverage-final.json. If omitted, json output will be sent to stdout.
-t or --type The type of report the output should be. For example remap-istanbul --output html-report --type html. If omitted, output defaults to json.
-b or --basePath When remapping the source files, instead of using the path in the source map, substitute this this path.

An example of piping a coverage file to the CLI and writing it out to a file:

$ cat coverage-final.json | ./node_modules/.bin/remap-istanbul -o coverage-remapped.json

An example of generating an HTML report off of remapped coverage:

$ ./node_modules/.bin/remap-istanbul -i coverage-final.json -o html-report -t html

An example of taking the stdin and writing the stdout in the CLI:

$ cat coverage-final.json | ./node_modules/.bin/remap-istanbul > coverage-remap.json

By default, Istanbul will generate lcov.info and HTML report and the coverage-final.json when it is run, but when integrated into test suite, the testing runner may very well augment the default behavior of the report output for Istanbul. We provide how to guides for Intern and Karma, but you should also check the documentation of your reporting tool on how to generate the coverage.json that represents the code you wish to cover.

Clone this wiki locally