grunt-mocha-chai-sinon
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "grunt-mocha-chai-sinon", | ||
"description": "MochaJS + ChaiJS + SinonJS Test Runner", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Marco Pegoraro", |
@@ -39,6 +39,8 @@ grunt-mocha-chai-sinon | ||
Test coverage support is provided by [node-jscoverage](https://github.com/visionmedia/node-jscoverage) while source code is _coverage enabled_ with [BlancketJS](http://blanketjs.org/). | ||
In order to activate test coverage you need to create a new configuration for the `grunt-mocha-chai-sinon` task and name it `coverage`. | ||
**The name matter!** | ||
'grunt-mocha-chai-sinon': { | ||
options: { | ||
coverageFilter: '/foo/foo1/' | ||
}, | ||
build: { | ||
@@ -57,2 +59,3 @@ src: ['./specs/**/*.spec.js'], | ||
quiet: true, | ||
filter: '/foo/foo1/', | ||
captureFile: './coverage.html' | ||
@@ -63,3 +66,6 @@ } | ||
By default `grunt-mocha-chai-sinon` add test coverage support to all loaded files who match the `/project-folder/src/` path but you can configure it with the `coverage.options.filter` option. | ||
[1]: http://gruntjs.com/ | ||
@@ -66,0 +72,0 @@ [2]: http://visionmedia.github.io/mocha/ |
@@ -11,7 +11,25 @@ /** | ||
// try to configure a coverage filter | ||
/** | ||
* Try to configure a coverage filter using the coverage specification from | ||
* the Grunt configuration. | ||
* | ||
* "/project-folder/src/" is used as default filter for test coverage | ||
*/ | ||
var filterProjectSrc = process.cwd(); | ||
filterProjectSrc = filterProjectSrc.substr(filterProjectSrc.lastIndexOf('/'), filterProjectSrc.length) + '/src/'; | ||
require('blanket')({ | ||
// Only files that match the pattern will be instrumented | ||
pattern: grunt.config.data['grunt-mocha-chai-sinon'].options.coverageFilter || '/src/' | ||
pattern: grunt.config.data['grunt-mocha-chai-sinon'].coverage.options.filter || filterProjectSrc | ||
}); | ||
/** | ||
* Grunt Task | ||
*/ | ||
@@ -38,8 +56,2 @@ grunt.registerMultiTask('grunt-mocha-chai-sinon', 'MochaJS + ChaiJS + SinonJS test runner', function() { | ||
/* | ||
mocha.run(function (errCount) { | ||
done(errCount === 0); | ||
}); | ||
*/ | ||
capture(options.captureFile, options.quiet, function(complete) { | ||
@@ -46,0 +58,0 @@ |
5426
85
73