Skip to content

Instantly share code, notes, and snippets.

@jcontonio
Created November 16, 2010 15:55
Show Gist options
  • Save jcontonio/701965 to your computer and use it in GitHub Desktop.
Save jcontonio/701965 to your computer and use it in GitHub Desktop.
Watchr script for running Jasmine BDD as autotest
# Run me with: $ watchr watchr.rb
def run(cmd)
puts(cmd)
system(cmd)
end
def run_all_tests
cmd = "ruby run_specs.rb -f n -c"
run(cmd)
end
watch( '^spec/.*Spec\.js' ) { run_all_tests }
watch( '^src/.*\.js' ) { run_all_tests }
# Ctrl-\
Signal.trap('QUIT') do
puts " --- Running all tests ---\n\n"
run_all_tests
end
# Ctrl-C
Signal.trap('INT') { abort("\n") }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment