Skip to content

Commit

Permalink
Merge pull request openlayers#2762 from tschaub/console-report
Browse files Browse the repository at this point in the history
Report test failures to the console.
  • Loading branch information
tschaub committed Sep 29, 2014
2 parents 62c0dbb + 291b033 commit b6c6dc0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
<!--
Expand Down

0 comments on commit b6c6dc0

Please sign in to comment.