Skip to content

Instantly share code, notes, and snippets.

@BryanDonovan
Last active December 14, 2015 03:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BryanDonovan/5022389 to your computer and use it in GitHub Desktop.
Save BryanDonovan/5022389 to your computer and use it in GitHub Desktop.
Example jakefile to run mocha tests
var Mocha = require('mocha');
var mocha = new Mocha({reporter: 'spec', ui: 'bdd'});
function run_tests(cb) {
mocha.addFile('./test/foo.unit.js');
mocha.run(function(failures) {
cb(failures);
});
}
desc('mocha unit test-run example');
task('test-run', {async: true}, function(args) {
run_tests(function(err) {
if (err) {
fail(err);
} else {
complete();
}
});
});
@linzhp
Copy link

linzhp commented May 9, 2014

When I run this in jake 0.7.13, the process doesn't automatically terminated. I have to use Ctrl+C to kill it after all tests are run. Is this the expected behavior?

@dev-sithu
Copy link

I could run mocha without jake in an application, but I couldn't succeed it in another app. Got ReferenceError: geddy is not defined. I think geddy should make mocha run without jake.

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