Skip to content

Instantly share code, notes, and snippets.

@gerhard
Created April 25, 2012 11:01
Show Gist options
  • Save gerhard/2488954 to your computer and use it in GitHub Desktop.
Save gerhard/2488954 to your computer and use it in GitHub Desktop.
guard-mocha
#!/usr/bin/env sh
all_tests=$(find ./test -type f -name "*test.coffee")
./node_modules/mocha/bin/mocha test/_helper.js ${1:-$all_tests}
source 'http://rubygems.org'
gem 'guard'
gem 'guard-shell'
guard 'shell' do
watch(%r{^(test/.*_test\.coffee)$}) { |m| system("./bin/mocha #{m[1]}") }
watch(%r{^lib/(.+)([^/]+)\.coffee$}) { |m| system("./bin/mocha test/lib/#{m[1]}#{m[2]}_test.coffee") }
end
process.env.NODE_ENV = 'test';
require('coffee-script');
@gerhard
Copy link
Author

gerhard commented Apr 25, 2012

I really love my guard & guard-minitest integration. Couldn't live without them, so here is my mocha port. Brownie points for what ./bin/mocha defaults to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment