Skip to content

Instantly share code, notes, and snippets.

@s4nchez
Created August 25, 2011 20:09
Show Gist options
  • Save s4nchez/1171743 to your computer and use it in GitHub Desktop.
Save s4nchez/1171743 to your computer and use it in GitHub Desktop.
Watchr config for jasmine-node
watch('./(.*).js') { |m| run_tests }
def run_tests
output = `jasmine-node spec/`
report output rescue nil
end
def report(output)
tests = /[0-9]+ tests?/.match(output).to_s;
failures = /[0-9]+ failures?/.match(output).to_s;
info = "#{tests}, #{failures}"
if /0 failures?/.match(failures);
title = "Success"
image = "~/.watchr_images/passed.png"
else
title = "Tests failing"
image = "~/.watchr_images/failed.png"
end
growlnotify = `which growlnotify`.chomp
options = "-w -n Watchr --image '#{File.expand_path(image)}' --html '#{title}' -m '#{info}'"
system %(#{growlnotify} #{options} &)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment