11import fs from 'fs' ;
2- import type { Reporter , TestCase , TestModule , TestSuite , Vitest } from 'vitest/node' ;
2+ import type { Reporter , RunnerTestFile , TestCase , TestModule , TestSuite , Vitest } from 'vitest/node' ;
33
44function * formatTestCase ( testCase : TestCase ) {
55 const passed = testCase . ok ( ) ;
@@ -62,10 +62,11 @@ export default class GithubActionsSummaryReporter implements Reporter {
6262 this . writeStream . write ( '## Test Results\n' ) ;
6363 for ( const testModule of modules ) {
6464 const passed = testModule . ok ( ) ;
65- const fileName : string = testModule . task ?? 'undefined' ;
65+ // @ts -expect-error idk where else to get the file information from
66+ const file : RunnerTestFile = testModule . task ;
6667 const testCount = getTestCount ( testModule ) ;
6768
68- this . writeStream . write ( `${ passed ? '✅' : '❌' } \`${ fileName } \` (${ testCount } test${ testCount === 1 ? '' : 's' } ) \n` ) ;
69+ this . writeStream . write ( `### ${ passed ? '✅' : '❌' } \`${ file . filepath } \` (${ testCount } test${ testCount === 1 ? '' : 's' } ) \n` ) ;
6970
7071 this . writeStream . write ( '<ul>' ) ;
7172 for ( const child of testModule . children ) {
@@ -79,7 +80,7 @@ export default class GithubActionsSummaryReporter implements Reporter {
7980 const totalDuration = diagnostics . duration . toFixed ( 0 ) ;
8081
8182 this . writeStream . write ( '\n\n' ) ;
82- this . writeStream . write ( `#### Summary for \`${ fileName } \`\n` ) ;
83+ this . writeStream . write ( `#### Summary for \`${ file . filepath } \`\n` ) ;
8384 this . writeStream . write ( '<table>\n' ) ;
8485 this . writeStream . write ( formatRow ( 'Test Files' , '' ) ) ;
8586 this . writeStream . write ( formatRow ( 'Tests' , testCount . toString ( ) ) ) ;
0 commit comments