Using Grunt - SitePen/remap-istanbul GitHub Wiki

You can utilize this package as a Grunt task.

Installation

Typically you will want Grunt and remap-istanbul installed as development dependencies for your project. In addition, you will likely want grunt-cli installed globally. To install Grunt and remap-istanbul you would run the following using NodeJS's package manager from the root of your project:

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

Configuration

After installation you need to add the following to your Gruntfile.js:

grunt.loadNpmTasks('remap-istanbul');

The task is a multi-target task and a basic configuration for the task would look something like this:

grunt.initConfig({
	remapIstanbul: {
		build: {
			src: 'coverage-final.json',
			options: {
				reports: {
					'lcovhtml': 'html-report',
					'json': 'coverage-final.json'
				}
			}
		}
	}
});

This would take in coverage-final.json, remap it and then output the Istanbul HTML report to html-report and overwrite the original coverage-final.json.

The task also recognizes an abbreviated version of configuration:

grunt.initConfig({
	remapIstanbul: {
		build: {
			files: [ {
				src: 'coverage-final.json',
				dest: 'tmp/coverage.json',
				type: 'json'
			} ]
		}
	}
});

You would then want to ensure that you have the remapIstanbul task initiated in your workflow after you have run your tests and had Istanbul generate the coverage-final.json file.