Runs jasmine-node with Istanbul code coverage
A Grunt task to run your Jasmine feature suite using jasmine-node and Istanbul for code coverage reports.
Install this grunt plugin next to your project's Gruntfile.js with:
npm install grunt-jasmine-node-coverage --save-devThen add these lines to your project's Gruntfile.js configuration file:
grunt.initConfig({
jasmine_node: {
task_name: {
options: {
coverage: {},
forceExit: true,
match: '.',
matchAll: false,
specFolders: ['tests'],
extensions: 'js',
specNameMatcher: 'spec',
captureExceptions: true,
junitreport: {
report: false,
savePath : './build/reports/jasmine/',
useDotNotation: true,
consolidate: true
}
},
src: ['**/*.js']
}
}
});
grunt.loadNpmTasks('grunt-jasmine-node-coverage');
grunt.registerTask('default', 'jasmine_node');Grunt tasks should be configured by following
the multi task configuration
form, thus wrapping each configuration in an object inside the jasmine_node root object.
Most of the options are passed throught to jasmine-node.
Type: string
Default: process.cwd()
See http://nodejs.org/api/process.html#process_process_cwd
Type: array
Default: [options.projectRoot]
List of folders in which any specs are looked for.
Type: boolean
Default: false
Type: boolean|object
Default: false
Istanbul specific configuration. Use empty object,
{} to use the defaults that are shown below.
{
reportFile: 'coverage.json',
print: 'summary', // none, summary, detail, both
relativize: true,
thresholds: {
statements: 0,
branches: 0,
lines: 0,
functions: 0
},
savePath: 'coverage',
report: [
'lcov'
],
collect: [ // false to disable
'coverage/*coverage.json'
],
excludes: []
}Please note that excludes will always contain '**/node_modules/**'.
Type: boolean
Default: false
Type: boolean
Default: true
When true and options.teamcity is false, will use
TerminalVerboseReporter, else TerminalReporter.
Type: boolean
Default: false
Exit on failure by skipping any asyncronous tasks pending.
Type: string
Default: '.'
used in the beginning of regular expression
Type: boolean
Default: false
When true, options.specFolders and options.specNameMatcher are
ignored while building the options.regExpSpec which is then
handed down to jasmine-node.
Type: string
Default: 'spec'
filename expression
Type: string
Default: 'js'
Used in regular expressions after dot, inside (), thus | could be used
Type: boolean
Default: false
{
report: false,
savePath: './reports/',
useDotNotation: true,
consolidate: true
}Type: boolean
Default: false
If true, will be using TeamcityReporter instead of possible isVerbose option
http://gotwarlost.github.io/istanbul/public/apidocs/classes/TeamcityReport.html
Type: boolean
Default: false
When true will be adding GrowlReporter.
See https://github.com/mhevery/jasmine-node#growl-notifications
Type: boolean
Default: false
Type: function
Default: null
Will be called on Terminal and Teamcity reporters and on RequireJS runner.
Type: boolean
Default: false
Used only in TerminalReporter.
Type: boolean
Default: false
Seems to be currently (1.4.3) only supported in the command line options of jasmine-node.
Help us to squash them by submitting an issue that describes how you encountered it;
please be as specific as possible including operating system, node, grunt, and
grunt-jasmine-node-coverage versions.
npm --versions- v0.3.1 (2014-11-21) Installation failed. Should fix #30
- v0.3.0 (2014-11-09) Grunt usage as multi task. Fixes #12 and #18
- v0.2.0 (2014-11-03) Better Grunt API usage. Fixes #10, #13, #14, #16, #19 and #20
- v0.1.11 (2014-05-15) Task name fix for
grunt.renametaskuse case - v0.1.10 (2014-04-07) JSHint configuration and task exit fixes
- v0.1.9 (2014-04-02)
jasmine_node.options.isVerbosewas not working - v0.1.8 (2014-03-03) Add captureExceptions support and quit on exception
- v0.1.7 (2013-12-13) Istanbul update, threshold configuration and JUNit output
- v0.1.6 (2013-07-26) Change
isVerboseoption toverbose - v0.1.5 (2013-07-15) Initial coverage with Istanbul release, originally forked from
grunt-jasmine-node
Copyright (c) 2013 "jribble" Jarrod Ribble & contributors. Based on grunt-jasmine-node.
Copyright (c) 2012 "s9tpepper" Omar Gonzalez & contributors. Licensed under the MIT license.