grunt-simple-istanbul
v3.0.3
Published
A grunt wrapper for istanbul
Downloads
42
Maintainers
Readme
grunt-simple-istanbul
A grunt wrapper for istanbul
Getting Started
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-simple-istanbul --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with:
grunt.loadNpmTasks('grunt-simple-istanbul');
Alternatively, install and use task-master, and it will handle this (and a lot more!) for you.
The "istanbul" task
This module uses the simple-cli library to create a simple wrapper around istanbul.
Overview
The istanbul
task is a multiTask, where the target is the istanbul command to run. You can configure as many istanbul commands as are useful to you either in your grunt.initConfig
call or, as mentioned above, by using task-master. Options to the istanbul binary go under options. However, the special key simple
indicates how this task should be run. See the examples below or the documentation for simple-cli.
grunt.initConfig({
istanbul: {
// istanbul instrument app --output instrumented -x **/node_modules/** -x **/coverage/** -x **/instrumented/** --no-compact true
instrument: {
options: {
output: 'instrumented',
x: ['**/node_modules/**', '**/coverage/**', '**/instrumented/**'],
noCompact: true,
simple: {
args: ['app']
}
}
},
// istanbul report --root /Users/foo/bar/my-repo/coverage --dir /Users/foo/bar/my-repo/coverage
report: {
options: {
root: __dirname + '/coverage',
dir: __dirname + '/coverage'
}
},
// istanbul cover grunt coverage:unit --hook-run-in-context --root server --dir /Users/foo/bar/my-repo/coverage/unit -x **/node_modules/** -x **/public/** -x **/instrumented/**
coverUnit: {
options: {
hookRunInContext: true,
root: 'server'
dir: __dirname + '/coverage/unit',
x: ['**/node_modules/**', '**/public/**', '**/instrumented/**'],
simple: {
cmd: 'cover'
args: ['grunt', 'coverage:unit']
}
}
}
}
});