Skip to content

Commit 5b6e5ed

Browse files
committed
- include flag to skip empty entries in summary
- Relates to: #1297 (comment)
1 parent f6cae89 commit 5b6e5ed

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ inputs:
106106
description: 'Skips summaries that would not contain failed tests'
107107
required: false
108108
default: 'false'
109+
include_empty_in_summary:
110+
description: 'Include entries in summaries that have 0 count'
111+
required: false
112+
default: 'true'
109113
group_suite:
110114
description: 'If enabled, will group the testcases by test suite in the `detailed_summary`'
111115
required: false

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export async function run(): Promise<void> {
3434
const flakySummary = core.getInput('flaky_summary') === 'true'
3535
const verboseSummary = core.getInput('verbose_summary') === 'true'
3636
const skipSuccessSummary = core.getInput('skip_success_summary') === 'true'
37+
const includeEmptyInSummary = core.getInput('include_empty_in_summary') === 'true'
3738
const groupSuite = core.getInput('group_suite') === 'true'
3839
const comment = core.getInput('comment') === 'true'
3940
const updateComment = core.getInput('updateComment') === 'true'
@@ -178,7 +179,8 @@ export async function run(): Promise<void> {
178179
flakySummary,
179180
verboseSummary,
180181
skipSuccessSummary,
181-
groupSuite
182+
groupSuite,
183+
includeEmptyInSummary
182184
)
183185
if (jobSummary && supportsJobSummary) {
184186
try {

src/table.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export function buildSummaryTables(
1010
flakySummary: boolean,
1111
verboseSummary: boolean,
1212
skipSuccessSummary: boolean,
13-
groupSuite = false
13+
groupSuite = false,
14+
includeEmptyInSummary = false
1415
): [SummaryTableRow[], SummaryTableRow[], SummaryTableRow[]] {
1516
// only include a warning icon if there are skipped tests
1617
const hasPassed = testResults.some(testResult => testResult.passed > 0)
@@ -58,10 +59,10 @@ export function buildSummaryTables(
5859
for (const testResult of testResults) {
5960
table.push([
6061
`${testResult.checkName}`,
61-
`${testResult.totalCount} ran`,
62-
`${testResult.passed} passed`,
63-
`${testResult.skipped} skipped`,
64-
`${testResult.failed} failed`
62+
includeEmptyInSummary || testResult.totalCount > 0 ? `${testResult.totalCount} ran` : ``,
63+
includeEmptyInSummary || testResult.passed > 0 ? `${testResult.passed} passed` : ``,
64+
includeEmptyInSummary || testResult.skipped > 0 ? `${testResult.skipped} skipped` : ``,
65+
includeEmptyInSummary || testResult.failed > 0 ? `${testResult.failed} failed` : ``
6566
])
6667

6768
const annotations = testResult.globalAnnotations.filter(

0 commit comments

Comments
 (0)