Update README; use empty string as default

This commit is contained in:
Michael Marcus 2025-03-28 17:11:15 -04:00 committed by Jozef Izso
parent 2b2d091d3d
commit 0f47a5bec1
4 changed files with 17 additions and 11 deletions

View file

@ -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.
@ -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

View file

@ -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 () => {

8
dist/index.js generated vendored
View file

@ -1817,7 +1817,8 @@ const defaultOptions = {
baseUrl: '',
onlySummary: false,
useActionsSummary: true,
badgeTitle: 'tests'
badgeTitle: 'tests',
reportTitle: ''
};
function getReport(results, options = defaultOptions) {
core.info('Generating check run summary');
@ -1880,9 +1881,8 @@ function getByteLength(text) {
}
function renderReport(results, options) {
const sections = [];
const { reportTitle } = options;
// Suppress the report title for empty string or whitespace
if (reportTitle && reportTitle.trim()) {
const reportTitle = options.reportTitle.trim();
if (reportTitle) {
sections.push(`# ${reportTitle}`);
}
const badge = getReportBadge(results, options);

View file

@ -15,7 +15,7 @@ export interface ReportOptions {
onlySummary: boolean
useActionsSummary: boolean
badgeTitle: string
reportTitle?: string
reportTitle: string
}
const defaultOptions: ReportOptions = {
@ -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 {
@ -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}`)
}