Add Coverage report for Unit and Integration tests

issue #361
- Added shell:coverage task to generate coverage report
- Registered test-coverage Grunt task as shortcut of shell:coverage
- Added coverage files to .gitignore
- Added require-cli and blanket to package.json
This commit is contained in:
germanrcuriel 2013-11-03 00:40:43 +01:00
parent ab639f7026
commit afbbee031e
4 changed files with 22 additions and 1 deletions

5
.gitignore vendored
View File

@ -57,4 +57,7 @@ CHANGELOG.md
config.js
# Built asset files
/core/built
/core/built
# Coverage reports
coverage.html

View File

@ -258,6 +258,9 @@ var path = require('path'),
shell: {
bourbon: {
command: 'bourbon install --path <%= paths.adminAssets %>/sass/modules/'
},
coverage: {
command: './node_modules/mocha/bin/mocha --timeout 15000 --reporter html-cov > coverage.html ./core/test/blanket_coverage.js'
}
},
@ -873,6 +876,11 @@ var path = require('path'),
grunt.registerTask('validate', 'Run tests and lint code', ['jslint', 'test-unit', 'test-integration', 'test-functional']);
// ## Coverage report for Unit and Integration Tests
grunt.registerTask('test-coverage', 'Generate unit and integration tests coverage report', ['clean:test', 'setTestEnv', 'loadConfig', 'express:test', 'shell:coverage']);
// ## Documentation
grunt.registerTask('docs', 'Generate Docs', ['groc']);

View File

@ -0,0 +1,8 @@
var blanket = require("blanket")({
"pattern": ["/core/server/", "/core/client/", "/core/shared/"],
"data-cover-only": ["/core/server/", "/core/client/", "/core/shared/"]
}),
requireDir = require("require-dir");
requireDir("./unit");
requireDir("./integration");

View File

@ -55,6 +55,7 @@
"mysql": "2.0.0-alpha9"
},
"devDependencies": {
"blanket": "~1.1.5",
"grunt": "~0.4.1",
"grunt-bump": "~0.0.11",
"grunt-contrib-clean": "~0.5.0",
@ -74,6 +75,7 @@
"matchdep": "~0.3.0",
"mocha": "~1.13.0",
"request": "~2.27.0",
"require-dir": "~0.1.0",
"should": "~2.0.2",
"sinon": "~1.7.3"
}