@@ -7,7 +7,7 @@ function* formatTestCase(testCase: TestCase) {
77 const diagnostics = testCase . diagnostic ( ) ;
88 const durationStr = diagnostics ? `${ diagnostics . duration . toFixed ( 0 ) } ms` : '' ;
99
10- yield `${ passed ? '✅' : '❌' } ${ testCase . name } ${ durationStr } \n` ;
10+ yield `${ passed ? '✅' : '❌' } ${ testCase . name } <code> ${ durationStr } </code> \n` ;
1111}
1212
1313function * formatTestSuite ( suite : TestSuite ) : Generator < string > {
@@ -48,6 +48,7 @@ function getTestCount(item: TestModule | TestSuite | TestCase): number {
4848export default class GithubActionsSummaryReporter implements Reporter {
4949 private writeStream : fs . WriteStream | null = null ;
5050 private vitest : Vitest | null = null ;
51+ private startTimes : Record < string , number > = { } ;
5152
5253 onInit ( vitest : Vitest ) {
5354 this . vitest = vitest ;
@@ -57,6 +58,10 @@ export default class GithubActionsSummaryReporter implements Reporter {
5758 }
5859 }
5960
61+ onTestModuleStart ( module : TestModule ) {
62+ this . startTimes [ module . id ] = performance . now ( ) ;
63+ }
64+
6065 onTestRunEnd ( modules : readonly TestModule [ ] ) {
6166 if ( ! this . writeStream ) return ;
6267
@@ -81,12 +86,16 @@ export default class GithubActionsSummaryReporter implements Reporter {
8186 const diagnostics = testModule . diagnostic ( ) ;
8287 const totalDuration = diagnostics . duration . toFixed ( 0 ) ;
8388
89+ const startTime = new Date ( this . startTimes [ testModule . id ] ) ;
90+ const hours = startTime . getHours ( ) . toString ( ) . padStart ( 2 , '0' ) ;
91+ const minutes = startTime . getMinutes ( ) . toString ( ) . padStart ( 2 , '0' ) ;
92+ const seconds = startTime . getSeconds ( ) . toString ( ) . padStart ( 2 , '0' ) ;
93+
8494 this . writeStream . write ( '\n\n' ) ;
85- this . writeStream . write ( `<h4>Summary for <code>${ file . filepath } </code></h4>\n` ) ;
95+ this . writeStream . write ( `<h4>Summary for <code>${ relpath } </code></h4>\n` ) ;
8696 this . writeStream . write ( '<table>\n' ) ;
87- this . writeStream . write ( formatRow ( 'Test Files' , '' ) ) ;
8897 this . writeStream . write ( formatRow ( 'Tests' , testCount . toString ( ) ) ) ;
89- this . writeStream . write ( formatRow ( 'Start at' , '' ) ) ;
98+ this . writeStream . write ( formatRow ( 'Start at' , ` ${ hours } : ${ minutes } : ${ seconds } ` ) ) ;
9099 this . writeStream . write ( formatRow ( 'Duration' , `${ totalDuration } ms` ) ) ;
91100 this . writeStream . write ( '</table>' ) ;
92101 }
0 commit comments