diff --git a/.gitignore b/.gitignore index e30b35fa06..fbf7ecf4eb 100644 --- a/.gitignore +++ b/.gitignore @@ -57,4 +57,7 @@ CHANGELOG.md config.js # Built asset files -/core/built \ No newline at end of file +/core/built + +# Coverage reports +coverage.html \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index f209e714ea..4c4840129f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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']); diff --git a/core/test/blanket_coverage.js b/core/test/blanket_coverage.js new file mode 100644 index 0000000000..deabd107a6 --- /dev/null +++ b/core/test/blanket_coverage.js @@ -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"); \ No newline at end of file diff --git a/package.json b/package.json index e64bbe3a3c..1d7e2b6398 100644 --- a/package.json +++ b/package.json @@ -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" }