Skip to content

Instantly share code, notes, and snippets.

@techieBrandon
Created May 14, 2013 19:42
Show Gist options
  • Save techieBrandon/5578866 to your computer and use it in GitHub Desktop.
Save techieBrandon/5578866 to your computer and use it in GitHub Desktop.
node watch.js
//Simply run your headless jasmine specs in parallel to your daily coffeescript work
//Usage: node watch.js
var sys = require('sys');
var exec = require('child_process').exec;
var watch = require('watch')
function puts(error, stdout, stderr) {
if(stdout!=undefined){sys.puts(stdout);} if(error!=undefined){sys.puts(error);} if(stderr!=undefined){sys.puts(stderr);} }
function headlessJasmineSpecRunner(){ exec("jasmine-headless-webkit -c -j spec/jasmine.yml", puts); }
watch.createMonitor('./',function (monitor) {
monitor.files['./'] // Stat object for my zshrc.
monitor.on("changed", function (f, curr, prev) {
if(/\.coffee$/.test(f)){
headlessJasmineSpecRunner();
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment