Skip to content

Instantly share code, notes, and snippets.

@bltavares
Created April 11, 2013 19:51
Show Gist options
  • Save bltavares/5366627 to your computer and use it in GitHub Desktop.
Save bltavares/5366627 to your computer and use it in GitHub Desktop.
Guardfile for mocha
# encoding: utf-8
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
notification :terminal_notifier_guard
guard :shell, :all_on_start => true do
watch(/^(test|lib)\/.+/) do
status = `./node_modules/mocha/bin/mocha 2>&1`.force_encoding("utf-8")
if status =~ /failed/
Notifier.notify("Failed", :title => "Some tests failed", :image => :failed)
else
Notifier.notify("Success", :title => "All green", :image => :success)
end
status
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment