@@ -149,15 +149,29 @@ export function getStateString(
149149 return c . dim ( `no ${ name } ` )
150150 }
151151
152- const passed = tasks . reduce ( ( acc , i ) => i . result ?. state === 'pass' ? acc + 1 : acc , 0 )
152+ const passed = tasks . reduce ( ( acc , i ) => {
153+ // Exclude expected failures from passed count
154+ if ( i . result ?. state === 'pass' && i . type === 'test' && ( i as any ) . fails ) {
155+ return acc
156+ }
157+ return i . result ?. state === 'pass' ? acc + 1 : acc
158+ } , 0 )
153159 const failed = tasks . reduce ( ( acc , i ) => i . result ?. state === 'fail' ? acc + 1 : acc , 0 )
154160 const skipped = tasks . reduce ( ( acc , i ) => i . mode === 'skip' ? acc + 1 : acc , 0 )
155161 const todo = tasks . reduce ( ( acc , i ) => i . mode === 'todo' ? acc + 1 : acc , 0 )
162+ const expectedFail = tasks . reduce ( ( acc , i ) => {
163+ // Count tests that are marked as .fails and passed (which means they failed as expected)
164+ if ( i . result ?. state === 'pass' && i . type === 'test' && ( i as any ) . fails ) {
165+ return acc + 1
166+ }
167+ return acc
168+ } , 0 )
156169
157170 return (
158171 [
159172 failed ? c . bold ( c . red ( `${ failed } failed` ) ) : null ,
160173 passed ? c . bold ( c . green ( `${ passed } passed` ) ) : null ,
174+ expectedFail ? c . cyan ( `${ expectedFail } expected fail` ) : null ,
161175 skipped ? c . yellow ( `${ skipped } skipped` ) : null ,
162176 todo ? c . gray ( `${ todo } todo` ) : null ,
163177 ]
0 commit comments