Skip to content

Commit 0068783

Browse files
alan-agius4clydin
authored andcommitted
fix(@angular-devkit/build-angular): show missing karma-coverage error 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 (cherry picked from commit 88a3794)
1 parent ffd04c7 commit 0068783

File tree

1 file changed

+3
-3
lines changed
  • packages/angular_devkit/build_angular/src/webpack/plugins

1 file changed

+3
-3
lines changed

packages/angular_devkit/build_angular/src/webpack/plugins/karma.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ const init: any = (config: any, emitter: any, customFileHandlers: any) => {
104104
else if (hasIstanbulPlugin && !hasIstanbulReporter) {
105105
// coverage-istanbul is deprecated in favor of karma-coverage
106106
reporters.push('coverage-istanbul');
107+
} else if (!hasCoveragePlugin && !hasIstanbulPlugin) {
108+
throw new Error('karma-coverage must be installed in order to run code coverage.');
107109
}
108-
else {
109-
throw new Error('karma-coverage must be installed in order to run code coverage');
110-
}
110+
111111
if (hasIstanbulPlugin) {
112112
logger.warn(`'karma-coverage-istanbul-reporter' usage has been deprecated since version 11.\n` +
113113
`Please install 'karma-coverage' and update 'karma.conf.js.' ` +

0 commit comments

Comments
 (0)