Skip to content

Instantly share code, notes, and snippets.

@wrumsby
Last active December 15, 2015 14:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wrumsby/5275804 to your computer and use it in GitHub Desktop.
Save wrumsby/5275804 to your computer and use it in GitHub Desktop.
Gruntfile that uses grunt-shell to run grover.
module.exports = function(grunt) {
'use strict';
var files = ['src/**/*.js', 'test/**/*.js'];
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
files: files
},
shell: {
grover: {
command: 'grover --phantom-bin phantomjs ./test/test-runner.html -o ./grover.json --json',
options: {
callback: function (err, stdout, stderr, cb) {
var fs = require('fs'),
data;
data = JSON.parse(fs.readFileSync('./grover.json'));
console.log(stdout);
cb(!(data.failed || data.errors));
}
}
}
},
watch: {
scripts: {
files: files,
tasks: ['shell:grover', 'jshint']
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-shell');
// n.b. this task doesn't work on Windows
grunt.loadNpmTasks('grunt-notify');
grunt.registerTask('default', ['watch']);
};
{
"name": "whatever",
"version": "0.0.1",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-watch": "~0.3.1",
"grunt-notify": "~0.1.4",
"grover": "~0.1.13",
"phantomjs": "~1.8.1-1",
"grunt-shell": "~0.2.1"
}
}
@wrumsby
Copy link
Author

wrumsby commented Mar 30, 2013

Instead of setting up PhantomJS to be on my path I installed the NPM wrapper and created a symbolic link to the bin provided by the wrapper:

ln -s ./node_modules/phantomjs/bin/phantomjs phantomjs

@MarshallOfSound
Copy link

There is now a grunt plugin specifically for doing this
https://www.npmjs.com/package/grunt-grover

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment