Skip to content

Commit

Permalink
Update README; use empty string as default
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Marcus authored and Jozef Izso committed May 17, 2025
1 parent 2b2d091 commit 0f47a5b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ jobs:
# Allows you to generate reports for Actions Summary
# https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/
use-actions-summary: 'true'
# Optionally specify a title (Heading level 1) for the report. Leading and trailing whitespace are ignored.
# This is useful for separating your test report from other sections in the build summary.
# If omitted or set to whitespace/empty, no title will be printed.
report-title: ''
# Customize the title of badges shown for each Actions Summary.
# Useful when distinguish summaries for tests ran in multiple Actions steps.
Expand Down Expand Up @@ -345,7 +350,7 @@ Support for Swift test results in xUnit format is experimental - should work but

Unfortunately, there are some known issues and limitations caused by GitHub API:

- Test report (i.e. Check Run summary) is markdown text. No custom styling or HTML is possible.
- Test report (i.e. build summary) is Markdown text. No custom styling or HTML is possible.
- Maximum report size is 65535 bytes. Input parameters `list-suites` and `list-tests` will be automatically adjusted if max size is exceeded.
- Test report can't reference any additional files (e.g. screenshots). You can use `actions/upload-artifact@v4` to upload them and inspect them manually.
- Check Runs are created for specific commit SHA. It's not possible to specify under which workflow test report should belong if more
Expand Down
3 changes: 2 additions & 1 deletion __tests__/java-junit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ describe('java-junit tests', () => {
baseUrl: '',
onlySummary: false,
useActionsSummary: true,
badgeTitle: 'tests'
badgeTitle: 'tests',
reportTitle: ''
}

it('produces empty test run result when there are no test cases', async () => {
Expand Down
8 changes: 4 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/report/get-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface ReportOptions {
onlySummary: boolean
useActionsSummary: boolean
badgeTitle: string
reportTitle?: string
reportTitle: string
}

const defaultOptions: ReportOptions = {
Expand All @@ -24,7 +24,8 @@ const defaultOptions: ReportOptions = {
baseUrl: '',
onlySummary: false,
useActionsSummary: true,
badgeTitle: 'tests'
badgeTitle: 'tests',
reportTitle: ''
}

export function getReport(results: TestRunResult[], options: ReportOptions = defaultOptions): string {
Expand Down Expand Up @@ -103,9 +104,8 @@ function getByteLength(text: string): number {
function renderReport(results: TestRunResult[], options: ReportOptions): string[] {
const sections: string[] = []

const {reportTitle} = options
// Suppress the report title for empty string or whitespace
if (reportTitle && reportTitle.trim()) {
const reportTitle: string = options.reportTitle.trim()
if (reportTitle) {
sections.push(`# ${reportTitle}`)
}

Expand Down

0 comments on commit 0f47a5b

Please sign in to comment.