Skip to end of metadata
Go to start of metadata

Add this code to the mocha test page html. Make sure you remove any calls to mocha.checkLeaks(), or add mochaResults to the list of global variables.

You can also clone this file directly from our GitHub repo

 onload = function(){
 var runner =;
 var failedTests = [];
 runner.on('end', function(){
 window.mochaResults = runner.stats;
 window.mochaResults.reports = failedTests;
 runner.on('fail', logFailure);
 function logFailure(test, err){
 var flattenTitles = function(test){
 var titles = [];
 while (test.parent.title){
 test = test.parent;
 return titles.reverse();
 failedTests.push({name: test.title, result: false, message: err.message, stack: err.stack, titles: flattenTitles(test) });

  • No labels