const istanbulAPI = require('istanbul-api');
const libCoverage = require('istanbul-lib-coverage');

function Istanbul(runner) {
  runner.on('end', () => {
    const mainReporter = istanbulAPI.createReporter();
    const coverageMap = libCoverage.createCoverageMap();

    coverageMap.merge(global.__coverage__ || {});

    mainReporter.addAll(['text', 'html']);
    mainReporter.write(coverageMap, {});
  });
}


module.exports = Istanbul;

const istanbulAPI = require('istanbul-api');
const libCoverage = require('istanbul-lib-coverage');
const Spec = require('mocha/lib/reporters/spec');

module.exports = class Istanbul extends Spec {
  constructor(runner) {
    super(runner);

    runner.on('end', () => {
      const mainReporter = istanbulAPI.createReporter();
      const coverageMap = libCoverage.createCoverageMap();

      coverageMap.merge(global.__coverage__ || {});

      mainReporter.addAll(['text', 'html']);
      mainReporter.write(coverageMap, {});
    });
  }
};

Update style of coverage reporter to be more ES6 like
Update style of coverage reporter to be more ES6 like

Extend the coverage reporter from the mocha spec reporter
