Report failures to the console

This commit is contained in:
Tim Schaub
2014-09-28 22:27:07 -06:00
parent afd43687f2
commit 291b033dbf

View File

@@ -46,7 +46,22 @@
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
} else {
mocha.run();
var runner = mocha.run();
if (window.console && console.log) {
// write stacks to the console for failed tests
runner.on('fail', function(test, err) {
if (test.duration > test._timeout) {
var titles = [];
for (var p = test; p; p = p.parent) {
if (p.title) {
titles.unshift(p.title);
}
}
console.log('Test timed out:', titles.join(' > '));
}
console.error(test.err.stack);
});
}
}
</script>
<!--