Skip to content

Commit 09d019e

Browse files
banjankrihansl
authored andcommitted
changing order of event and coverage reporters
Fixing an issue when event reporter is executed before coverage reporter, which was causing the test command to pass even though unit testing coverage thresholds were not met.
1 parent 839c1f8 commit 09d019e

File tree

1 file changed

+7
-6
lines changed
  • packages/angular_devkit/build_angular/src/angular-cli-files/plugins

1 file changed

+7
-6
lines changed

packages/angular_devkit/build_angular/src/angular-cli-files/plugins/karma.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ const init: any = (config: any, emitter: any, customFileHandlers: any) => {
6767
failureCb = config.buildWebpack.failureCb;
6868

6969
config.reporters.unshift('@angular-devkit/build-angular--event-reporter');
70+
71+
// When using code-coverage, auto-add coverage-istanbul.
72+
config.reporters = config.reporters || [];
73+
if (options.codeCoverage && config.reporters.indexOf('coverage-istanbul') === -1) {
74+
config.reporters.unshift('coverage-istanbul');
75+
}
76+
7077
// Add a reporter that fixes sourcemap urls.
7178
if (options.sourceMap) {
7279
config.reporters.unshift('@angular-devkit/build-angular--sourcemap-reporter');
@@ -107,12 +114,6 @@ const init: any = (config: any, emitter: any, customFileHandlers: any) => {
107114
config.webpack = Object.assign(webpackConfig, config.webpack);
108115
config.webpackMiddleware = Object.assign(webpackMiddlewareConfig, config.webpackMiddleware);
109116

110-
// When using code-coverage, auto-add coverage-istanbul.
111-
config.reporters = config.reporters || [];
112-
if (options.codeCoverage && config.reporters.indexOf('coverage-istanbul') === -1) {
113-
config.reporters.push('coverage-istanbul');
114-
}
115-
116117
// Our custom context and debug files list the webpack bundles directly instead of using
117118
// the karma files array.
118119
config.customContextFile = `${__dirname}/karma-context.html`;

0 commit comments

Comments
 (0)