Skip to content

Commit

Permalink
added benchmark task, fixes jsoverson#71
Browse files Browse the repository at this point in the history
  • Loading branch information
BendingBender committed Jul 5, 2015
1 parent 68062ec commit e34eb7e
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/node_modules/
/test/tmp
/benchmark/result.csv
/coverage
.idea
*.iml
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/node_modules/
/test/tmp
/benchmark/result.csv
/coverage
.idea
*.iml
18 changes: 17 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ module.exports = function(grunt) {
clean: {
coverage: {
src: ['coverage']
},
test: {
src: ['test/tmp']
},
benchmark: {
src: ['benchmark/result.csv']
}
},
copy: {
Expand Down Expand Up @@ -80,10 +86,20 @@ module.exports = function(grunt) {
],
tasks: ['test', 'coverage']
}
},
benchmark: {
options: {
displayResults: true
},

'mochaTest-preprocess': {
src: ['benchmark/gruntMochaTestPreprocess.js'],
dest: 'benchmark/result.csv'
}
}
});

grunt.registerTask('prepare-cov', ['clean', 'blanket', 'copy']);
grunt.registerTask('prepare-cov', ['clean:coverage', 'blanket', 'copy']);
grunt.registerTask('coverage',
['prepare-cov', 'mochaTest:html-cov', 'mochaTest:mocha-lcov-reporter', 'mochaTest:travis-cov']);
grunt.registerTask('test', ['jshint', 'mochaTest:preprocess']);
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ changed functionality. Lint and test your code using jshint
- changed `@extend` and `@exclude` html regex so that directives may appear more than once in one line (via @BendingBender, #36)
- fixed multiple issues with coffescript syntax (via @BendingBender, #39)
- fixed multiple issues with newlines (via @BendingBender, #8, potentially breaking)
- fixed `@if` and `@foreach` to not require trailing whitespace (via @BendingBender, #74)
- 2.3.1 Fixed @echo and @exec directives to allow `-` and `*` characters, fixed @exec with multiple params
(via @BendingBender, #21, #45, #51, #54).
- 2.3.0 Added support for @include-static (via @BendingBender)
Expand Down
21 changes: 21 additions & 0 deletions benchmark/gruntMochaTestPreprocess.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

var spawn = require('child_process').spawn;

module.exports = {
name: 'grunt mochaTest:preprocess',
maxTime: 10,
defer: true,
fn: function(deferred) {
var spawnGrunt = spawn(process.argv[0], [process.argv[1], 'mochaTest:preprocess']);

spawnGrunt.stderr.on('data', function(data) {
deferred.resolve();
throw new Error(data);
});

spawnGrunt.on('exit', function() {
deferred.resolve();
});
}
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"chai": "^3.0.0",
"chai-spies": "^0.6.0",
"grunt": "~0.4.1",
"grunt-benchmark": "^0.3.0",
"grunt-blanket": "0.0.8",
"grunt-cli": "^0.1.13",
"grunt-contrib-clean": "^0.6.0",
Expand Down

0 comments on commit e34eb7e

Please sign in to comment.