Skip to content

Commit f847db8

Browse files
cexbrayatclydin
authored andcommitted
fix(@schematics/angular): remove duplicated Karma traces
Currently, Karma is reporting a failed test and the total twice in a bare CLI project: ``` 12 11 2020 13:59:46.666:INFO [launcher]: Starting browser Chrome ✔ Browser application bundle generation complete. 12 11 2020 13:59:50.457:INFO [Chrome 86.0.4240.198 (Mac OS 10.15.7)]: Connected on socket F0ehOBWL6BYFqXfbAAAA with id 69358036 Chrome 86.0.4240.198 (Mac OS 10.15.7) AppComponent should render title FAILED Error: Expected 'ponyracer app is running!' to contain 'other'. at <Jasmine> at UserContext.<anonymous> (src/app/app.component.spec.ts:29:65) at ZoneDelegate.invoke (node_modules/zone.js/dist/zone-evergreen.js:364:1) at ProxyZoneSpec.push.QpwO.ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/zone-testing.js:292:1) Chrome 86.0.4240.198 (Mac OS 10.15.7): Executed 2 of 3 (1 FAILED) (0 secs / 0.231 secs) Chrome 86.0.4240.198 (Mac OS 10.15.7) AppComponent should render title FAILED Error: Expected 'ponyracer app is running!' to contain 'other'. at <Jasmine> at UserContext.<anonymous> (src/app/app.component.spec.ts:29:65) at ZoneDelegate.invoke (node_modules/zone.js/dist/zone-evergreen.js:364:1) Chrome 86.0.4240.198 (Mac OS 10.15.7): Executed 3 of 3 (1 FAILED) (0.309 secs / 0.242 secs) TOTAL: 1 FAILED, 2 SUCCESS TOTAL: 1 FAILED, 2 SUCCESS ``` This is a bit annoying when you have several tests failing, and tend to confuse beginners. This commit configures the Karma HTML reporter to suppress the duplicates (both error and success), which results in only one reporter showing the failed test and total: ``` 12 11 2020 14:01:43.002:INFO [launcher]: Starting browser Chrome ✔ Browser application bundle generation complete. 12 11 2020 14:01:58.728:INFO [Chrome 86.0.4240.198 (Mac OS 10.15.7)]: Connected on socket Pc0xPggxJPdC8E_LAAAA with id 54797430 Chrome 86.0.4240.198 (Mac OS 10.15.7) AppComponent should render title FAILED Error: Expected 'ponyracer app is running!' to contain 'other'. at <Jasmine> at UserContext.<anonymous> (src/app/app.component.spec.ts:29:65) at ZoneDelegate.invoke (node_modules/zone.js/dist/zone-evergreen.js:364:1) at ProxyZoneSpec.push.QpwO.ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/zone-testing.js:292:1) Chrome 86.0.4240.198 (Mac OS 10.15.7): Executed 3 of 3 (1 FAILED) (0.331 secs / 0.252 secs) TOTAL: 1 FAILED, 2 SUCCESS ``` (cherry picked from commit 53193ea)
1 parent e8c9067 commit f847db8

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

integration/angular_cli/karma.conf.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module.exports = function (config) {
1818
client: {
1919
clearContext: false, // leave Jasmine Spec Runner output visible in browser
2020
},
21+
jasmineHtmlReporter: {
22+
suppressAll: true // removes the duplicated traces
23+
},
2124
coverageReporter: {
2225
dir: path.join(__dirname, 'coverage'),
2326
subdir: '.',

packages/angular_devkit/build_angular/test/hello-world-app/karma.conf.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ module.exports = function(config) {
2525
client: {
2626
clearContext: false, // leave Jasmine Spec Runner output visible in browser
2727
},
28+
jasmineHtmlReporter: {
29+
suppressAll: true // removes the duplicated traces
30+
},
2831
coverageReporter: {
2932
dir: path.join(__dirname, './coverage'),
3033
subdir: '.',

packages/angular_devkit/build_angular/test/hello-world-lib/projects/lib/karma.conf.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ module.exports = function (config) {
2222
client: {
2323
clearContext: false // leave Jasmine Spec Runner output visible in browser
2424
},
25+
jasmineHtmlReporter: {
26+
suppressAll: true // removes the duplicated traces
27+
},
2528
coverageIstanbulReporter: {
2629
dir: require('path').join(__dirname, 'coverage'),
2730
reports: ['html', 'lcovonly'],

packages/schematics/angular/application/files/karma.conf.js.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ module.exports = function (config) {
1515
client: {
1616
clearContext: false // leave Jasmine Spec Runner output visible in browser
1717
},
18+
jasmineHtmlReporter: {
19+
suppressAll: true // removes the duplicated traces
20+
},
1821
coverageReporter: {
1922
dir: require('path').join(__dirname, '<%= relativePathToWorkspaceRoot %>/coverage/<%= appName%>'),
2023
subdir: '.',

packages/schematics/angular/library/files/karma.conf.js.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ module.exports = function (config) {
1515
client: {
1616
clearContext: false // leave Jasmine Spec Runner output visible in browser
1717
},
18+
jasmineHtmlReporter: {
19+
suppressAll: true // removes the duplicated traces
20+
},
1821
coverageReporter: {
1922
dir: require('path').join(__dirname, '<%= relativePathToWorkspaceRoot %>/coverage/<%= folderName %>'),
2023
subdir: '.',

0 commit comments

Comments
 (0)