Intern How To - SitePen/remap-istanbul GitHub Wiki

This page answers the question of how to utilize remap-istanbul with Intern.

Installation

You will need intern and remap-istanbul as part of your project's development dependencies, so from the root of your project:

$ npm install intern remap-istanbul --save-dev

Usage

In order to have Intern generate a JSON coverage report, you will need to instruct Intern to utilize the JsonCoverage reporter. Running Intern 3 runner from a command line, from the root of your project path would look like this:

$ node_modules/.bin/intern-runner config=tests/intern reporters=Console reporters=node_modules/remap-istanbul/lib/intern-reporters/JsonCoverage

By default, when the test run completes a ./coverage-final.json file will be created against your built code. In order to have this remapped to the source code, you will then need to run remap-istanbul. From the command line, this would look like this:

$ node_modules/.bin/remap-istanbul -i coverage-final.json -o coverage-mapped.json

This would then output a ./coverage-mapped.json that has been remapped to your source files.

References

There are a lot more options and ways of invoking Intern and remap-istanbul and this How To is not exhaustive. Please refer to the appropriate documentation to better understand all the options available to you: