Skip to content

report-title not working #610

@GSDragoon

Description

@GSDragoon

Describe the bug

There's at least a couple issues. I was trying use the new report-title option added with PR 568.

The first issue was that the new report-title option is missing from the GitHub Action's input. The mentioned PR added the back end logic, tests and even updated the documentation, but missed adding it to the action.

I thought it was going to be a simple fix, so I forked the repo and added it to the action. That's when I noticed the report title wasn't displaying as I would expect. What happens is that the value of the only-summary option's text being added as the header of the report (even with only-summary set to false), on the same line as the report title, just before it.

Using report-title: Testing 123 you get a top level report heading/title of # X passed, Y failed and Z skipped # Testing 123.

To Reproduce

I have an example here using the report-title option. It shows the behavior of the report when using the different options.
GSDragoon/testing-test-reporter@master...test/test-reporter-title
https://github.com/GSDragoon/testing-test-reporter/actions/runs/15596943919

It was done using a fork of this repo that adds the missing report-title option: main...GSDragoon:test-reporter:fix/report-title-input

Expected behavior

My Opinions:

  • A report should have a heading using the report-title value only if it is specified.
  • If only-summary is used and not report-title, then it should use the existing summary value showing the number of passed, failed and skipped tests.
  • If both report-title and only-summary are used, then I would suggest either append the test results summary after the report title for a heading or have the test results summary below the report title.

Screenshots

First report is with report-title. Second is with a report-title and only-summary true. Third is no report-title and only-summary true.
Image

Additional context

Digging into this more, I believe and issue is in createReport, around this area:

test-reporter/src/main.ts

Lines 177 to 215 in a6b3e93

if (this.useActionsSummary) {
const summary = getReport(results, {
listSuites,
listTests,
baseUrl,
onlySummary,
useActionsSummary,
badgeTitle,
reportTitle
})
core.info('Summary content:')
core.info(summary)
core.summary.addRaw(`# ${shortSummary}`)
await core.summary.addRaw(summary).write()
} else {
core.info(`Creating check run ${name}`)
const createResp = await this.octokit.rest.checks.create({
head_sha: this.context.sha,
name,
status: 'in_progress',
output: {
title: name,
summary: ''
},
...github.context.repo
})
core.info('Creating report summary')
baseUrl = createResp.data.html_url as string
const summary = getReport(results, {
listSuites,
listTests,
baseUrl,
onlySummary,
useActionsSummary,
badgeTitle,
reportTitle
})

Specifically this line, where it starts off appending what seems to be the only-summary value to the beginning.
core.summary.addRaw(`# ${shortSummary}`)

At the same time, renderReport is also setting the heading of the report-title value:
const reportTitle: string = options.reportTitle.trim()
if (reportTitle) {
sections.push(`# ${reportTitle}`)
}

There seems to be some weird logic with the report-title and the only-summary options not playing nice together. I'm not sure what the correct behavior should be but what it's currently doing doesn't make sense.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions