@@ -94,8 +94,12 @@ export function statsWarningsToString(json: any, statsConfig: any) {
9494 const colors = statsConfig . colors ;
9595 const rs = ( x : string ) => colors ? reset ( x ) : x ;
9696 const y = ( x : string ) => colors ? bold ( yellow ( x ) ) : x ;
97+ const warnings = [ ...json . warnings ] ;
98+ if ( json . children ) {
99+ warnings . push ( ...json . children . map ( ( c : any ) => c . warnings ) ) ;
100+ }
97101
98- return rs ( '\n' + json . warnings
102+ return rs ( '\n' + warnings
99103 . map ( ( warning : any ) => `${ warning } ` )
100104 . filter ( ( warning : string ) => ! ERRONEOUS_WARNINGS . some ( ( erroneous ) => erroneous . test ( warning ) ) )
101105 . map ( ( warning : string ) => y ( `WARNING in ${ warning } ` ) )
@@ -106,6 +110,18 @@ export function statsErrorsToString(json: any, statsConfig: any) {
106110 const colors = statsConfig . colors ;
107111 const rs = ( x : string ) => colors ? reset ( x ) : x ;
108112 const r = ( x : string ) => colors ? bold ( red ( x ) ) : x ;
113+ const errors = [ ...json . errors ] ;
114+ if ( json . children ) {
115+ errors . push ( ...json . children . map ( ( c : any ) => c . errors ) ) ;
116+ }
117+
118+ return rs ( '\n' + errors . map ( ( error : any ) => r ( `ERROR in ${ error } ` ) ) . join ( '\n' ) ) ;
119+ }
120+
121+ export function statsHasErrors ( json : any ) : boolean {
122+ return json . errors . length > 0 || ! ! json . children ?. some ( ( c : any ) => c . errors . length ) ;
123+ }
109124
110- return rs ( '\n' + json . errors . map ( ( error : any ) => r ( `ERROR in ${ error } ` ) ) . join ( '\n' ) ) ;
125+ export function statsHasWarnings ( json : any ) : boolean {
126+ return json . warnings . length > 0 || ! ! json . children ?. some ( ( c : any ) => c . warnings . length ) ;
111127}
0 commit comments