@@ -247,8 +247,23 @@ function requestBlocker() {
247247}
248248
249249// Strip the server address and webpack scheme (webpack://) from error log.
250- const initSourcemapReporter : any = function ( this : any , baseReporterDecorator : any ) {
250+ const initSourcemapReporter : any = function ( this : any , baseReporterDecorator : any , config : any ) {
251251 baseReporterDecorator ( this ) ;
252+
253+ const reporterName = '@angular/cli' ;
254+ const hasTrailingReporters = config . reporters . slice ( - 1 ) . pop ( ) !== reporterName ;
255+
256+ // Copied from "karma-jasmine-diff-reporter" source code:
257+ // In case, when multiple reporters are used in conjunction
258+ // with initSourcemapReporter, they both will show repetitive log
259+ // messages when displaying everything that supposed to write to terminal.
260+ // So just suppress any logs from initSourcemapReporter by doing nothing on
261+ // browser log, because it is an utility reporter,
262+ // unless it's alone in the "reporters" option and base reporter is used.
263+ if ( hasTrailingReporters ) {
264+ this . writeCommonMsg = function ( ) { } ;
265+ }
266+
252267 const urlRegexp = / \( h t t p : \/ \/ l o c a l h o s t : \d + \/ _ k a r m a _ w e b p a c k _ \/ w e b p a c k : \/ / gi;
253268
254269 this . onSpecComplete = function ( _browser : any , result : any ) {
@@ -260,7 +275,7 @@ const initSourcemapReporter: any = function (this: any, baseReporterDecorator: a
260275 } ;
261276} ;
262277
263- initSourcemapReporter . $inject = [ 'baseReporterDecorator' ] ;
278+ initSourcemapReporter . $inject = [ 'baseReporterDecorator' , 'config' ] ;
264279
265280module . exports = Object . assign ( {
266281 'framework:@angular/cli' : [ 'factory' , init ] ,
0 commit comments