Skip to content

Commit

Permalink
fix: don't log errors twice when using multiple reporters
Browse files Browse the repository at this point in the history
Fixes #44
  • Loading branch information
Matt Lewis committed May 23, 2018
1 parent 18f2c67 commit a17b6ca
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ function checkThresholds(thresholds, summary) {
function CoverageIstanbulReporter(baseReporterDecorator, logger, config) {
baseReporterDecorator(this);

// Copied from https://github.com/angular/angular-cli/pull/9529/files
// Fixes https://github.com/mattlewis92/karma-coverage-istanbul-reporter/issues/44
const reporterName = 'coverage-istanbul';
const hasTrailingReporters =
config.reporters.slice(-1).pop() !== reporterName;
if (hasTrailingReporters) {
this.writeCommonMsg = () => {};
}

const log = logger.create('reporter.coverage-istanbul');
const browserCoverage = new WeakMap();
const coverageConfig = Object.assign({}, config.coverageIstanbulReporter);
Expand Down

0 comments on commit a17b6ca

Please sign in to comment.