16
16
17
17
const RED_COLOR = '\x1b[31m' ;
18
18
const GREEN_COLOR = '\x1b[32m' ;
19
+ const GRAY_COLOR = '\x1b[90m' ;
19
20
const YELLOW_COLOR = '\x1b[33m' ;
20
21
const MAGENTA_COLOR = '\x1b[35m' ;
21
22
const RESET_COLOR = '\x1b[0m' ;
@@ -202,16 +203,19 @@ class Reporter {
202
203
this . _workersState . set ( workerId , { test, isRunning : false } ) ;
203
204
if ( this . _verbose ) {
204
205
++ this . _testCounter ;
206
+ let prefix = `${ this . _testCounter } )` ;
207
+ if ( this . _runner . parallel ( ) > 1 )
208
+ prefix += ` ${ GRAY_COLOR } [worker = ${ workerId } ]${ RESET_COLOR } ` ;
205
209
if ( test . result === 'ok' ) {
206
- console . log ( `${ this . _testCounter } ) ${ GREEN_COLOR } [ OK ]${ RESET_COLOR } ${ test . fullName } (${ formatTestLocation ( test ) } )` ) ;
210
+ console . log ( `${ prefix } ${ GREEN_COLOR } [ OK ]${ RESET_COLOR } ${ test . fullName } (${ formatTestLocation ( test ) } )` ) ;
207
211
} else if ( test . result === 'terminated' ) {
208
- console . log ( `${ this . _testCounter } ) ${ MAGENTA_COLOR } [ TERMINATED ]${ RESET_COLOR } ${ test . fullName } (${ formatTestLocation ( test ) } )` ) ;
212
+ console . log ( `${ prefix } ${ MAGENTA_COLOR } [ TERMINATED ]${ RESET_COLOR } ${ test . fullName } (${ formatTestLocation ( test ) } )` ) ;
209
213
} else if ( test . result === 'crashed' ) {
210
- console . log ( `${ this . _testCounter } ) ${ RED_COLOR } [ CRASHED ]${ RESET_COLOR } ${ test . fullName } (${ formatTestLocation ( test ) } )` ) ;
214
+ console . log ( `${ prefix } ${ RED_COLOR } [ CRASHED ]${ RESET_COLOR } ${ test . fullName } (${ formatTestLocation ( test ) } )` ) ;
211
215
} else if ( test . result === 'skipped' ) {
212
- console . log ( `${ this . _testCounter } ) ${ YELLOW_COLOR } [SKIP]${ RESET_COLOR } ${ test . fullName } (${ formatTestLocation ( test ) } )` ) ;
216
+ console . log ( `${ prefix } ${ YELLOW_COLOR } [SKIP]${ RESET_COLOR } ${ test . fullName } (${ formatTestLocation ( test ) } )` ) ;
213
217
} else if ( test . result === 'failed' ) {
214
- console . log ( `${ this . _testCounter } ) ${ RED_COLOR } [FAIL]${ RESET_COLOR } ${ test . fullName } (${ formatTestLocation ( test ) } )` ) ;
218
+ console . log ( `${ prefix } ${ RED_COLOR } [FAIL]${ RESET_COLOR } ${ test . fullName } (${ formatTestLocation ( test ) } )` ) ;
215
219
console . log ( ' Message:' ) ;
216
220
console . log ( ` ${ RED_COLOR } ${ test . error . message || test . error } ${ RESET_COLOR } ` ) ;
217
221
console . log ( ' Stack:' ) ;
@@ -222,7 +226,7 @@ class Reporter {
222
226
console . log ( test . output . split ( '\n' ) . map ( line => ' ' + line ) . join ( '\n' ) ) ;
223
227
}
224
228
} else if ( test . result === 'timedout' ) {
225
- console . log ( `${ this . _testCounter } ) ${ RED_COLOR } [TIME]${ RESET_COLOR } ${ test . fullName } (${ formatTestLocation ( test ) } )` ) ;
229
+ console . log ( `${ prefix } ${ RED_COLOR } [TIME]${ RESET_COLOR } ${ test . fullName } (${ formatTestLocation ( test ) } )` ) ;
226
230
console . log ( ' Message:' ) ;
227
231
console . log ( ` ${ RED_COLOR } Timeout Exceeded ${ this . _runner . timeout ( ) } ms${ RESET_COLOR } ` ) ;
228
232
}
0 commit comments