Merge pull request #2762 from tschaub/console-report

Report test failures to the console.
This commit is contained in:
Tim Schaub
2014-09-29 14:07:55 -06:00

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>
<!--