src/mochawesome.js
function done(output, options, config, failures, exit) {
  return marge.create(output, options)
    .then(([ htmlFile, jsonFile ]) => {
      if (!htmlFile && !jsonFile) {
        log('No files were generated', 'warn', config);
      } else {
        jsonFile && log(`Report JSON saved to ${jsonFile}`, null, config);
        htmlFile && log(`Report HTML saved to ${htmlFile}`, null, config);
      }
    })
    .catch(err => {
      log(err, 'error', config);
    })
    .then(() => {
      exit && exit(failures > 0 ? 1 : 0);
    });
}
function done(output, options, config, failures, exit) {
  return marge.create(output, options)
    .then(([ htmlFile, jsonFile ]) => {
      if (!htmlFile && !jsonFile) {
        log('No files were generated', 'warn', config);
      } else {
        jsonFile && log(`Report JSON saved to ${jsonFile}`, null, config);
        htmlFile && log(`Report HTML saved to ${htmlFile}`, null, config);
      }
    })
    .catch(err => {
      log(err, 'error', config);
    })
    .then(() => {
      exit && exit(failures > 0 ? 1 : 0);
    });
}
function done ( output , options , config , failures , exit ) { return marge . create ( output , options ) . then ( ( [ htmlFile , jsonFile ] ) => { if ( ! htmlFile && ! jsonFile ) { log ( 'No files were generated' , 'warn' , config ) ; } else { jsonFile && log ( ` ${ jsonFile } ` , null , config ) ; htmlFile && log ( ` ${ htmlFile } ` , null , config ) ; } } ) . catch ( err => { log ( err , 'error' , config ) ; } ) . then ( ( ) => { exit && exit ( failures > 0 ? 1 : 0 ) ; } ) ; }
Done function gets called before mocha exits

Creates and saves the report HTML and JSON files

@param {Object} output    Final report object
@param {Object} options   Options to pass to report generator
@param {Object} config    Reporter config object
@param {Number} failures  Number of reported failures
@param {Function} exit

@return {Promise} Resolves with successful report creation
Done function gets called before mocha exits