Skip to content

Commit b14027d

Browse files
authored
Merge pull request #1310 from mikepenz/feature/simplified_summary
Simplified Summary configuration
2 parents a0c4e6c + fa83f1f commit b14027d

File tree

7 files changed

+55
-32
lines changed

7 files changed

+55
-32
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ jobs:
9898
| `detailed_summary` | Optional. Include table with all test results in the summary (Also applies to comment). Defaults to `false`. |
9999
| `flaky_summary` | Optional. Include table with all flaky results in the summary (Also applies to comment). Defaults to `false`. |
100100
| `verbose_summary` | Optional. Detail table will note if there were no test annotations for a test suite (Also applies to comment). Defaults to `true`. |
101-
| `skip_success_summary` | Optional. Skips the summary table if only successful tests were detected (Also applies to comment). Defaults to `false`. |
101+
| `skip_success_summary` | Optional. Skips the summary table if only successful tests were detected (Also applies to comment). Defaults to `false`. |
102+
| `include_empty_in_summary` | Optional. Include entries in summaries that have 0 count. Defaults to `true`. |
103+
| `simplified_summary` | Optional. Use icons instead of text to indicate status in summary. Defaults to `false`. |
102104
| `group_suite` | Optional. If enabled, will group the testcases by test suite in the `detailed_summary`. Defaults to `false`. |
103105
| `comment` | Optional. Enables a comment being added to the PR with the summary tables (Respects the summary configuration flags). Defaults to `false`. |
104106
| `updateComment` | Optional. If a prior action run comment exists, it is updated. If disabled, new comments are creted for each run. Defaults to `true`. |

__tests__/table.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ describe('buildSummaryTables', () => {
7979
colspan: '2'
8080
}
8181
],
82-
['ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)', '✅ pass'],
83-
['ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)', '✅ pass'],
84-
['ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)', '✅ pass']
82+
['ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)', '✅ passed'],
83+
['ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)', '✅ passed'],
84+
['ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)', '✅ passed']
8585
])
8686
expect(flakyTable).toStrictEqual(FLAKY_TABLE)
8787
})
@@ -146,15 +146,15 @@ describe('buildSummaryTables', () => {
146146
colspan: '2'
147147
}
148148
],
149-
['ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)', '✅ pass'],
150-
['ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)', '✅ pass'],
149+
['ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)', '✅ passed'],
150+
['ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)', '✅ passed'],
151151
[
152152
{
153153
data: '<em>ABC-0045: Multi-User Chat</em>',
154154
colspan: '2'
155155
}
156156
],
157-
['ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)', '✅ pass']
157+
['ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)', '✅ passed']
158158
])
159159
expect(flakyTable).toStrictEqual(FLAKY_TABLE)
160160
})

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ inputs:
110110
description: 'Include entries in summaries that have 0 count'
111111
required: false
112112
default: 'true'
113+
simplified_summary:
114+
description: 'Use icons instead of text to indicate status in summary'
115+
required: false
116+
default: 'false'
113117
group_suite:
114118
description: 'If enabled, will group the testcases by test suite in the `detailed_summary`'
115119
required: false

dist/index.js

Lines changed: 18 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export async function run(): Promise<void> {
3535
const verboseSummary = core.getInput('verbose_summary') === 'true'
3636
const skipSuccessSummary = core.getInput('skip_success_summary') === 'true'
3737
const includeEmptyInSummary = core.getInput('include_empty_in_summary') === 'true'
38+
const simplifiedSummary = core.getInput('simplified_summary') === 'true'
3839
const groupSuite = core.getInput('group_suite') === 'true'
3940
const comment = core.getInput('comment') === 'true'
4041
const updateComment = core.getInput('updateComment') === 'true'
@@ -180,7 +181,8 @@ export async function run(): Promise<void> {
180181
verboseSummary,
181182
skipSuccessSummary,
182183
groupSuite,
183-
includeEmptyInSummary
184+
includeEmptyInSummary,
185+
simplifiedSummary
184186
)
185187
if (jobSummary && supportsJobSummary) {
186188
try {

src/table.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export function buildSummaryTables(
1111
verboseSummary: boolean,
1212
skipSuccessSummary: boolean,
1313
groupSuite = false,
14-
includeEmptyInSummary = false
14+
includeEmptyInSummary = true,
15+
simplifiedSummary = false
1516
): [SummaryTableRow[], SummaryTableRow[], SummaryTableRow[]] {
1617
// only include a warning icon if there are skipped tests
1718
const hasPassed = testResults.some(testResult => testResult.passed > 0)
@@ -28,6 +29,12 @@ export function buildSummaryTables(
2829
const skippedHeader = hasSkipped ? 'Skipped ⚠️' : 'Skipped'
2930
const failedHeader = hasFailed ? 'Failed ❌️' : 'Failed'
3031

32+
const passedIcon = simplifiedSummary ? '✅' : 'passed'
33+
const skippedIcon = simplifiedSummary ? '⚠️' : 'skipped'
34+
const failedIcon = simplifiedSummary ? '❌' : 'failed'
35+
const passedDetailIcon = simplifiedSummary ? '✅' : '✅ passed'
36+
const skippedDetailIcon = simplifiedSummary ? '⚠️' : '⚠️ skipped'
37+
3138
const table: SummaryTableRow[] = [
3239
[
3340
{data: '', header: true},
@@ -60,9 +67,9 @@ export function buildSummaryTables(
6067
table.push([
6168
`${testResult.checkName}`,
6269
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` : ``
70+
includeEmptyInSummary || testResult.passed > 0 ? `${testResult.passed} ${passedIcon}` : ``,
71+
includeEmptyInSummary || testResult.skipped > 0 ? `${testResult.skipped} ${skippedIcon}` : ``,
72+
includeEmptyInSummary || testResult.failed > 0 ? `${testResult.failed} ${failedIcon}` : ``
6673
])
6774

6875
const annotations = testResult.globalAnnotations.filter(
@@ -87,16 +94,16 @@ export function buildSummaryTables(
8794
`${annotation.title}`,
8895
`${
8996
annotation.status === 'success'
90-
? '✅ pass'
97+
? passedDetailIcon
9198
: annotation.status === 'skipped'
92-
? `⚠️️ skipped`
99+
? skippedDetailIcon
93100
: `❌ ${annotation.annotation_level}`
94101
}`
95102
])
96103
}
97104
} else {
98105
for (const internalTestResult of testResult.testResults) {
99-
appendDetailsTable(internalTestResult, detailsTable, includePassed)
106+
appendDetailsTable(internalTestResult, detailsTable, includePassed, passedDetailIcon, skippedDetailIcon)
100107
}
101108
}
102109
}
@@ -118,7 +125,9 @@ export function buildSummaryTables(
118125
function appendDetailsTable(
119126
testResult: ActualTestResult,
120127
detailsTable: SummaryTableRow[],
121-
includePassed: boolean
128+
includePassed: boolean,
129+
passedDetailIcon: string,
130+
skippedDetailIcon: string
122131
): void {
123132
const annotations = testResult.annotations.filter(
124133
annotation => includePassed || annotation.annotation_level !== 'notice'
@@ -130,15 +139,15 @@ function appendDetailsTable(
130139
`${annotation.title}`,
131140
`${
132141
annotation.status === 'success'
133-
? '✅ pass'
142+
? passedDetailIcon
134143
: annotation.status === 'skipped'
135-
? `⚠️️ skipped`
144+
? skippedDetailIcon
136145
: `❌ ${annotation.annotation_level}`
137146
}`
138147
])
139148
}
140149
}
141150
for (const childTestResult of testResult.testResults) {
142-
appendDetailsTable(childTestResult, detailsTable, includePassed)
151+
appendDetailsTable(childTestResult, detailsTable, includePassed, passedDetailIcon, skippedDetailIcon)
143152
}
144153
}

0 commit comments

Comments
 (0)