Skip to content

Instantly share code, notes, and snippets.

@enginespot
Created December 23, 2012 13:37
Show Gist options
  • Save enginespot/4363454 to your computer and use it in GitHub Desktop.
Save enginespot/4363454 to your computer and use it in GitHub Desktop.
debug mocha test with IDE
var Mocha = require('mocha'),
path = require('path'),
fs = require('fs');
var mocha = new Mocha({
reporter: 'dot',
ui: 'bdd',
timeout: 999999
});
var testDir = './test/';
fs.readdir(testDir, function (err, files) {
if (err) {
console.log(err);
return;
}
files.forEach(function (file) {
if (path.extname(file) === '.js') {
console.log('adding test file: %s', file);
mocha.addFile(testDir + file);
}
});
var runner = mocha.run(function () {
console.log('finished');
});
runner.on('pass', function (test) {
console.log('... %s passed', test.title);
});
runner.on('fail', function (test) {
console.log('... %s failed', test.title);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment