@@ -94,8 +94,12 @@ export function statsWarningsToString(json: any, statsConfig: any) {
94
94
const colors = statsConfig . colors ;
95
95
const rs = ( x : string ) => colors ? reset ( x ) : x ;
96
96
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
+ }
97
101
98
- return rs ( '\n' + json . warnings
102
+ return rs ( '\n' + warnings
99
103
. map ( ( warning : any ) => `${ warning } ` )
100
104
. filter ( ( warning : string ) => ! ERRONEOUS_WARNINGS . some ( ( erroneous ) => erroneous . test ( warning ) ) )
101
105
. map ( ( warning : string ) => y ( `WARNING in ${ warning } ` ) )
@@ -106,6 +110,18 @@ export function statsErrorsToString(json: any, statsConfig: any) {
106
110
const colors = statsConfig . colors ;
107
111
const rs = ( x : string ) => colors ? reset ( x ) : x ;
108
112
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
+ }
109
124
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 ) ;
111
127
}
0 commit comments