lib/reporters/console.js
function _end(debug) {

  const DEBUG_FIELDS = ['exitcode', 'output', 'stdout', 'stderr'];

  var summary = util.format(
    '%d test%s, %d success%s, %d failure%s',
    successes.length + failures.length,
    (successes.length + failures.length > 1) ? 's' : '',
    successes.length,
    (successes.length > 1) ? 'es' : '',
    failures.length,
    (failures.length > 1) ? 's' : ''
  );

  console.log('');

  if (failures.length === 0) {
    console.log(summary.green);

  } else {

    failures.forEach(function (failure) {
      console.error(util.format('' +
          '\n----------------' +
          '\n%s%s' +
          '\n%s',
        failure.test.description ? failure.test.description + '\n' : '',
        failure.test.file.cyan,
        failure.test.command));

      failure.errors.forEach(function (error) {
        console.error(error.red);
      });

      if (debug) {
        console.error('exec dir: %s\n'.grey, failure.test.dir);

        DEBUG_FIELDS.forEach(function (field) {
          if (failure.test[field]) {
            console.error('%s: %s\n'.grey, field, failure.result[field]);
          }
        });
      }
    });

    console.error(summary.red);
  }

}
function _end(debug) {

  const DEBUG_FIELDS = ['exitcode', 'output', 'stdout', 'stderr'];

  var summary = util.format(
    '%d test%s, %d success%s, %d failure%s',
    successes.length + failures.length,
    (successes.length + failures.length > 1) ? 's' : '',
    successes.length,
    (successes.length > 1) ? 'es' : '',
    failures.length,
    (failures.length > 1) ? 's' : ''
  );

  console.log('');

  if (failures.length === 0) {
    console.log(summary.green);

  } else {

    failures.forEach(function (failure) {
      console.error(util.format('' +
          '\n----------------' +
          '\n%s%s' +
          '\n%s',
        failure.test.description ? failure.test.description + '\n' : '',
        failure.test.file.cyan,
        failure.test.command));

      failure.errors.forEach(function (error) {
        console.error(error.red);
      });

      if (debug) {
        console.error('exec dir: %s\n'.grey, failure.test.dir);

        DEBUG_FIELDS.forEach(function (field) {
          if (failure.test[field]) {
            console.error('%s: %s\n'.grey, field, failure.result[field]);
          }
        });
      }
    });

    console.error(summary.red);
  }

}
function _end ( debug ) { const DEBUG_FIELDS = [ 'exitcode' , 'output' , 'stdout' , 'stderr' ] ; var summary = util . format ( '%d test%s, %d success%s, %d failure%s' , successes . length + failures . length , ( successes . length + failures . length > 1 ) ? 's' : '' , successes . length , ( successes . length > 1 ) ? 'es' : '' , failures . length , ( failures . length > 1 ) ? 's' : '' ) ; console . log ( '' ) ; if ( failures . length === 0 ) { console . log ( summary . green ) ; } else { failures . forEach ( function ( failure ) { console . error ( util . format ( '' + '\n----------------' + '\n%s%s' + '\n%s' , failure . test . description ? failure . test . description + '\n' : '' , failure . test . file . cyan , failure . test . command ) ) ; failure . errors . forEach ( function ( error ) { console . error ( error . red ) ; } ) ; if ( debug ) { console . error ( 'exec dir: %s\n' . grey , failure . test . dir ) ; DEBUG_FIELDS . forEach ( function ( field ) { if ( failure . test [ field ] ) { console . error ( '%s: %s\n' . grey , field , failure . result [ field ] ) ; } } ) ; } } ) ; console . error ( summary . red ) ; } }
End event handler, displays test summary and optional debug message.

@param {Boolean} debug: if true, displays result output and exit code
End event handler displays test summary and optional debug message .