[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

feat: include project name in GitHub Actions reporter summary heading

Agent-Logs-Url: https://github.com/vitest-dev/vitest/sessions/1bf8e14a-923e-4427-a9ff-f77391f357e9

Co-authored-by: sheremet-va <16173870+sheremet-va@users.noreply.github.com>

authored by

copilot-swe-agent[bot]
sheremet-va
and committed by
GitHub
(Apr 8, 2026, 8:35 AM UTC) 54b98d04 d20fc24a

+35 -3
+31
test/cli/test/reporters/github-actions.test.ts
··· 121 121 `) 122 122 }) 123 123 124 + it('includes project name in heading when set', async ({ onTestFinished }) => { 125 + const outputPath = resolve(tmpdir(), randomUUID()) 126 + 127 + onTestFinished(async () => { 128 + await rm(outputPath).catch(() => { 129 + console.error(`Could not remove ${outputPath}`) 130 + }) 131 + }) 132 + 133 + const workspacePath = resolve(import.meta.dirname, '..', '..', '..', '..') 134 + 135 + await runVitest({ 136 + name: 'my-project', 137 + reporters: new GithubActionsReporter({ 138 + jobSummary: { 139 + outputPath, 140 + fileLinks: { 141 + commitHash: 'aaa', 142 + repository: 'owner/repo', 143 + workspacePath, 144 + }, 145 + }, 146 + }), 147 + root: './fixtures/reporters/github-actions', 148 + }) 149 + 150 + const summary = await readFile(outputPath, 'utf8') 151 + 152 + expect(summary.startsWith('## Vitest Test Report (my-project)\n')).toBe(true) 153 + }) 154 + 124 155 it.for([{ enabled: false }, { outputPath: undefined }] as const)('does not write one when disabled or without `outputPath`', async (options) => { 125 156 const outputPath = resolve(tmpdir(), randomUUID()) 126 157
+4 -3
packages/vitest/src/node/reporters/github-actions.ts
··· 177 177 } 178 178 179 179 if (this.options.jobSummary.enabled === true && this.options.jobSummary.outputPath) { 180 - const summary = renderSummary(collectSummaryData(testModules), this.options.jobSummary.fileLinks) 180 + const summary = renderSummary(collectSummaryData(testModules), this.options.jobSummary.fileLinks, this.ctx.config.name) 181 181 182 182 try { 183 183 writeFileSync( ··· 440 440 441 441 const SUMMARY_HEADER = '## Vitest Test Report\n' 442 442 443 - function renderSummary(summaryData: SummaryData, fileLinks?: JobSummaryOptions['fileLinks']): string { 443 + function renderSummary(summaryData: SummaryData, fileLinks?: JobSummaryOptions['fileLinks'], name?: string): string { 444 444 const fileLinkCreator = createGitHubFileLinkCreator(fileLinks) 445 445 446 - let summary = `${SUMMARY_HEADER}${renderStats(summaryData)}` 446 + const heading = name ? `## Vitest Test Report (${name})\n` : SUMMARY_HEADER 447 + let summary = `${heading}${renderStats(summaryData)}` 447 448 448 449 if (summaryData.flakyTests.length > 0) { 449 450 summary += '\n### Flaky Tests\n\nThese tests passed only after one or more retries, indicating potential instability.\n'