diff --git a/test/index.html b/test/index.html index e8400cbaef..bcabf83267 100644 --- a/test/index.html +++ b/test/index.html @@ -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); + }); + } }