@@ -50,7 +50,40 @@ 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+ // Check if this is a run-multiple process (contains : or .)
62+ // Format: "1.runName:browserName" from run-multiple
63+ if ( String ( processValue ) . includes ( ':' ) || ( String ( processValue ) . includes ( '.' ) && String ( processValue ) . split ( '.' ) . length > 1 ) ) {
64+ // Keep original format for run-multiple
65+ outputProcess = colors . cyan . bold ( `[${ processValue } ]` )
66+ } else {
67+ // Standard worker format for run-workers
68+ const processNum = parseInt ( processValue , 10 )
69+ const processStr = ! isNaN ( processNum ) ? String ( processNum ) . padStart ( 2 , '0' ) : String ( processValue ) . padStart ( 2 , '0' )
70+
71+ // Assign different colors to different workers for better identification
72+ const workerColors = [
73+ colors . cyan , // Worker 01 - Cyan
74+ colors . magenta , // Worker 02 - Magenta
75+ colors . green , // Worker 03 - Green
76+ colors . yellow , // Worker 04 - Yellow
77+ colors . blue , // Worker 05 - Blue
78+ colors . red , // Worker 06 - Red
79+ colors . white , // Worker 07 - White
80+ colors . gray , // Worker 08 - Gray
81+ ]
82+ const workerIndex = ! isNaN ( processNum ) ? processNum - 1 : - 1
83+ const colorFn = workerIndex >= 0 && workerColors [ workerIndex % workerColors . length ] ? workerColors [ workerIndex % workerColors . length ] : colors . cyan
84+ outputProcess = colorFn . bold ( `[Worker ${ processStr } ]` )
85+ }
86+ }
5487 return outputProcess
5588 } ,
5689
@@ -149,25 +182,38 @@ module.exports = {
149182 * @param {Mocha.Test } test
150183 */
151184 started ( test ) {
152- print ( ` ${ colors . magenta . bold ( test . title ) } ` )
185+ // Only show feature name in workers mode (when outputProcess is set)
186+ const featureName = outputProcess && test . parent ?. title ? `${ colors . cyan . bold ( test . parent . title ) } › ` : ''
187+ print ( ` ${ featureName } ${ colors . magenta . bold ( test . title ) } ` )
153188 } ,
154189 /**
155190 * @param {Mocha.Test } test
156191 */
157192 passed ( test ) {
158- print ( ` ${ colors . green . bold ( figures . tick ) } ${ test . title } ${ colors . grey ( `in ${ test . duration } ms` ) } ` )
193+ // Only show feature name in workers mode (when outputProcess is set)
194+ const featureName = outputProcess && test . parent ?. title ? `${ colors . cyan ( test . parent . title ) } › ` : ''
195+ const scenarioName = colors . bold ( test . title )
196+ const executionTime = colors . cyan ( `in ${ test . duration } ms` )
197+ print ( ` ${ colors . green . bold ( figures . tick ) } ${ featureName } ${ scenarioName } ${ executionTime } ` )
159198 } ,
160199 /**
161200 * @param {Mocha.Test } test
162201 */
163202 failed ( test ) {
164- print ( ` ${ colors . red . bold ( figures . cross ) } ${ test . title } ${ colors . grey ( `in ${ test . duration } ms` ) } ` )
203+ // Only show feature name in workers mode (when outputProcess is set)
204+ const featureName = outputProcess && test . parent ?. title ? `${ colors . yellow ( test . parent . title ) } › ` : ''
205+ const scenarioName = colors . bold ( test . title )
206+ const executionTime = colors . yellow ( `in ${ test . duration } ms` )
207+ print ( ` ${ colors . red . bold ( figures . cross ) } ${ featureName } ${ scenarioName } ${ executionTime } ` )
165208 } ,
166209 /**
167210 * @param {Mocha.Test } test
168211 */
169212 skipped ( test ) {
170- print ( ` ${ colors . yellow . bold ( 'S' ) } ${ test . title } ` )
213+ // Only show feature name in workers mode (when outputProcess is set)
214+ const featureName = outputProcess && test . parent ?. title ? `${ colors . gray ( test . parent . title ) } › ` : ''
215+ const scenarioName = colors . bold ( test . title )
216+ print ( ` ${ colors . yellow . bold ( 'S' ) } ${ featureName } ${ scenarioName } ` )
171217 } ,
172218 } ,
173219
0 commit comments