Skip to content

Instantly share code, notes, and snippets.

@vvo
Created August 2, 2013 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vvo/6138726 to your computer and use it in GitHub Desktop.
Save vvo/6138726 to your computer and use it in GitHub Desktop.
Git pre-push hook to launch `NODE_ENV=test grunt test` and check for return code
#!/usr/bin/env node
var spawn = require('child_process').spawn;
var cmd = 'grunt';
var args = ['test'];
var options = {
stdio: 'inherit'
};
process.env.NODE_ENV = 'test';
spawn(cmd, args, options).on('exit', check);
function check(code) {
if (code !== 0) {
throw 'Tests did not pass';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment