Skip to content

Commit

Permalink
add Grunt task to measure code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
hegemonic committed Dec 26, 2013
1 parent 58c7395 commit e2b8dc3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Development-related files
.tern-port
coverage/
node_modules/.bin
node_modules/grunt*
node_modules/istanbul
node_modules/jshint
node_modules/load-grunt-tasks

Expand Down
12 changes: 11 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
nodeBin: path.resolve(__dirname, './jsdoc.js'),
nodePath: process.execPath,
rhinoBin: (function() {
var filepath = path.resolve(__dirname, './jsdoc');

Expand Down Expand Up @@ -37,6 +38,13 @@ module.exports = function(grunt) {
files: ['package.json']
},
shell: {
'coverage': {
command: './node_modules/.bin/istanbul cover <%= nodeBin %> -- -T',
options: {
stdout: true,
stderr: true
}
},
'test-rhino': {
command: '<%= rhinoBin %> -T -q "parser=rhino"',
options: {
Expand All @@ -52,7 +60,7 @@ module.exports = function(grunt) {
}
},
'test-node': {
command: process.execPath + ' <%= nodeBin %> -T',
command: '<%= nodePath %> <%= nodeBin %> -T',
options: {
stdout: true,
stderr: true
Expand All @@ -65,6 +73,8 @@ module.exports = function(grunt) {

grunt.renameTask('bumpup', 'bump');

grunt.registerTask('coverage', ['shell:coverage']);

grunt.registerTask('test-rhino', ['shell:test-rhino']);
grunt.registerTask('test-rhino-esprima', ['shell:test-rhino-esprima']);
grunt.registerTask('test-node', ['shell:test-node']);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"grunt": "~0.4.2",
"grunt-bumpup": "~0.4.2",
"grunt-shell": "~0.6.1",
"istanbul": "~0.2.1",
"jshint": "~2.3.0",
"load-grunt-tasks": "~0.2.1",
"tv4": "git+https://github.com/hegemonic/tv4.git#own-properties"
Expand Down

0 comments on commit e2b8dc3

Please sign in to comment.