@@ -50,7 +50,34 @@ module.exports = {
5050 */
5151 process ( process ) {
5252 if ( process === null ) return ( outputProcess = '' )
53- if ( process ) outputProcess = String ( process ) . length === 1 ? `[0${ process } ]` : `[${ process } ]`
53+ if ( process ) {
54+ // Handle objects by converting to empty string or extracting properties
55+ let processValue = process
56+ if ( typeof process === 'object' ) {
57+ // If it's an object, try to extract a numeric value or use empty string
58+ processValue = process . id || process . index || process . worker || ''
59+ }
60+
61+ const processNum = parseInt ( processValue , 10 )
62+ const processStr = ! isNaN ( processNum ) ? String ( processNum ) . padStart ( 2 , '0' ) : String ( processValue ) . padStart ( 2 , '0' )
63+
64+ // Assign different colors to different workers for better identification
65+ const workerColors = [
66+ colors . cyan , // Worker 01 - Cyan
67+ colors . magenta , // Worker 02 - Magenta
68+ colors . green , // Worker 03 - Green
69+ colors . yellow , // Worker 04 - Yellow
70+ colors . blue , // Worker 05 - Blue
71+ colors . red , // Worker 06 - Red
72+ colors . white , // Worker 07 - White
73+ colors . gray , // Worker 08 - Gray
74+ ]
75+ const workerIndex = ! isNaN ( processNum ) ? processNum - 1 : - 1
76+ const colorFn = workerIndex >= 0 && workerColors [ workerIndex % workerColors . length ]
77+ ? workerColors [ workerIndex % workerColors . length ]
78+ : colors . cyan
79+ outputProcess = colorFn . bold ( `[Worker ${ processStr } ]` )
80+ }
5481 return outputProcess
5582 } ,
5683
@@ -149,25 +176,34 @@ module.exports = {
149176 * @param {Mocha.Test } test
150177 */
151178 started ( test ) {
152- print ( ` ${ colors . magenta . bold ( test . title ) } ` )
179+ const featureName = test . parent ?. title ? `${ colors . cyan . bold ( test . parent . title ) } › ` : ''
180+ print ( ` ${ featureName } ${ colors . magenta . bold ( test . title ) } ` )
153181 } ,
154182 /**
155183 * @param {Mocha.Test } test
156184 */
157185 passed ( test ) {
158- print ( ` ${ colors . green . bold ( figures . tick ) } ${ test . title } ${ colors . grey ( `in ${ test . duration } ms` ) } ` )
186+ const featureName = test . parent ?. title ? `${ colors . cyan ( test . parent . title ) } › ` : ''
187+ const scenarioName = colors . bold ( test . title )
188+ const executionTime = colors . cyan ( `in ${ test . duration } ms` )
189+ print ( ` ${ colors . green . bold ( figures . tick ) } ${ featureName } ${ scenarioName } ${ executionTime } ` )
159190 } ,
160191 /**
161192 * @param {Mocha.Test } test
162193 */
163194 failed ( test ) {
164- print ( ` ${ colors . red . bold ( figures . cross ) } ${ test . title } ${ colors . grey ( `in ${ test . duration } ms` ) } ` )
195+ const featureName = test . parent ?. title ? `${ colors . yellow ( test . parent . title ) } › ` : ''
196+ const scenarioName = colors . bold ( test . title )
197+ const executionTime = colors . yellow ( `in ${ test . duration } ms` )
198+ print ( ` ${ colors . red . bold ( figures . cross ) } ${ featureName } ${ scenarioName } ${ executionTime } ` )
165199 } ,
166200 /**
167201 * @param {Mocha.Test } test
168202 */
169203 skipped ( test ) {
170- print ( ` ${ colors . yellow . bold ( 'S' ) } ${ test . title } ` )
204+ const featureName = test . parent ?. title ? `${ colors . gray ( test . parent . title ) } › ` : ''
205+ const scenarioName = colors . bold ( test . title )
206+ print ( ` ${ colors . yellow . bold ( 'S' ) } ${ featureName } ${ scenarioName } ` )
171207 } ,
172208 } ,
173209
0 commit comments