Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): show missing karma-coverage error…
Browse files Browse the repository at this point in the history
… when it's not configured

This fixes an issue where previously `karma-coverage must be installed in order to run code coverage` error was shown incorrectly.

Closes: #19359
  • Loading branch information
alan-agius4 authored and clydin committed Nov 12, 2020
1 parent 73542ad commit 88a3794
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,13 @@ const init: any = (config: any, emitter: any, customFileHandlers: any) => {
const hasIstanbulReporter = reporters.includes('coverage-istanbul');
if (hasCoveragePlugin && !hasCoverageReporter) {
reporters.push('coverage');
}
else if (hasIstanbulPlugin && !hasIstanbulReporter) {
} else if (hasIstanbulPlugin && !hasIstanbulReporter) {
// coverage-istanbul is deprecated in favor of karma-coverage
reporters.push('coverage-istanbul');
} else if (!hasCoveragePlugin && !hasIstanbulPlugin) {
throw new Error('karma-coverage must be installed in order to run code coverage.');
}
else {
throw new Error('karma-coverage must be installed in order to run code coverage');
}

if (hasIstanbulPlugin) {
logger.warn(`'karma-coverage-istanbul-reporter' usage has been deprecated since version 11.\n` +
`Please install 'karma-coverage' and update 'karma.conf.js.' ` +
Expand Down

0 comments on commit 88a3794

Please sign in to comment.