@@ -218,6 +218,7 @@ export abstract class BaseReporter implements Reporter {
218218 const collectTime = files . reduce ( ( acc , test ) => acc + Math . max ( 0 , test . collectDuration || 0 ) , 0 )
219219 const setupTime = files . reduce ( ( acc , test ) => acc + Math . max ( 0 , test . setupDuration || 0 ) , 0 )
220220 const testsTime = files . reduce ( ( acc , test ) => acc + Math . max ( 0 , test . result ?. duration || 0 ) , 0 )
221+ const transformTime = Array . from ( this . ctx . vitenode . fetchCache . values ( ) ) . reduce ( ( a , b ) => a + ( b ?. duration || 0 ) , 0 )
221222 const threadTime = collectTime + testsTime + setupTime
222223
223224 const padTitle = ( str : string ) => c . dim ( `${ str . padStart ( 10 ) } ` )
@@ -227,6 +228,14 @@ export abstract class BaseReporter implements Reporter {
227228 return `${ Math . round ( time ) } ms`
228229 }
229230
231+ // show top 10 costly transform module
232+ // console.log(Array.from(this.ctx.vitenode.fetchCache.entries()).filter(i => i[1].duration)
233+ // .sort((a, b) => b[1].duration! - a[1].duration!)
234+ // .map(i => `${time(i[1].duration!)} ${i[0]}`)
235+ // .slice(0, 10)
236+ // .join('\n'),
237+ // )
238+
230239 const snapshotOutput = renderSnapshotSummary ( this . ctx . config . root , this . ctx . snapshot . summary )
231240 if ( snapshotOutput . length ) {
232241 logger . log ( snapshotOutput . map ( ( t , i ) => i === 0
@@ -243,7 +252,7 @@ export abstract class BaseReporter implements Reporter {
243252 if ( this . watchFilters )
244253 logger . log ( padTitle ( 'Duration' ) , time ( threadTime ) )
245254 else
246- logger . log ( padTitle ( 'Duration' ) , time ( executionTime ) + c . gray ( ` (setup ${ time ( setupTime ) } , collect ${ time ( collectTime ) } , tests ${ time ( testsTime ) } )` ) )
255+ logger . log ( padTitle ( 'Duration' ) , time ( executionTime ) + c . dim ( ` (transform ${ time ( transformTime ) } , setup ${ time ( setupTime ) } , collect ${ time ( collectTime ) } , tests ${ time ( testsTime ) } )` ) )
247256
248257 logger . log ( )
249258 }
0 commit comments