11import fs from 'fs' ;
2+ import pathlib from 'path' ;
23import type { Reporter , RunnerTestFile , TestCase , TestModule , TestSuite , Vitest } from 'vitest/node' ;
34
45function * formatTestCase ( testCase : TestCase ) {
@@ -64,9 +65,10 @@ export default class GithubActionsSummaryReporter implements Reporter {
6465 const passed = testModule . ok ( ) ;
6566 // @ts -expect-error idk where else to get the file information from
6667 const file : RunnerTestFile = testModule . task ;
68+ const relpath = pathlib . relative ( testModule . project . config . root , file . filepath ) ;
6769 const testCount = getTestCount ( testModule ) ;
6870
69- this . writeStream . write ( `### ${ passed ? '✅' : '❌' } \` ${ file . filepath } \` (${ testCount } test${ testCount === 1 ? '' : 's' } ) \n` ) ;
71+ this . writeStream . write ( `<h3> ${ passed ? '✅' : '❌' } <code> ${ relpath } </code> (${ testCount } test${ testCount === 1 ? '' : 's' } )</h3> \n` ) ;
7072
7173 this . writeStream . write ( '<ul>' ) ;
7274 for ( const child of testModule . children ) {
@@ -80,7 +82,7 @@ export default class GithubActionsSummaryReporter implements Reporter {
8082 const totalDuration = diagnostics . duration . toFixed ( 0 ) ;
8183
8284 this . writeStream . write ( '\n\n' ) ;
83- this . writeStream . write ( `#### Summary for \` ${ file . filepath } \` \n` ) ;
85+ this . writeStream . write ( `<h4> Summary for <code> ${ file . filepath } </code></h4> \n` ) ;
8486 this . writeStream . write ( '<table>\n' ) ;
8587 this . writeStream . write ( formatRow ( 'Test Files' , '' ) ) ;
8688 this . writeStream . write ( formatRow ( 'Tests' , testCount . toString ( ) ) ) ;
0 commit comments