Skip to content

Commit 249ff86

Browse files
committed
feat: add 'folded' input option for report summary
1 parent 7102eb7 commit 249ff86

File tree

10 files changed

+67
-18
lines changed

10 files changed

+67
-18
lines changed

.github/workflows/build-and-test.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,7 @@ jobs:
2525
with:
2626
report-path: './ctrf/*.json'
2727
summary-report: true
28-
github-report: true
29-
failed-report: true
30-
flaky-report: true
31-
insights-report: true
32-
fail-rate-report: true
33-
flaky-rate-report: true
34-
slowest-report: true
35-
previous-results-report: true
36-
use-suite-name: true
28+
test-table-report: true
3729
upload-artifact: true
3830
env:
3931
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ inputs:
211211
should be displayed in the summary.
212212
required: false
213213
default: ''
214+
folded:
215+
description: 'Fold the folded reports in the summary.'
216+
required: false
217+
default: ''
214218

215219
# Integration Configuration
216220
integrations-config:

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

dist/index.js

Lines changed: 22 additions & 2 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.

dist/reports/test-table.hbs

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

src/core/cli.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export interface Arguments {
3939
fetchPreviousResults?: boolean
4040
reportOrder?: string
4141
maxWorkflowRunsToCheck?: number
42+
folded?: string | boolean
4243
}
4344

4445
async function main(): Promise<void> {
@@ -328,7 +329,12 @@ async function main(): Promise<void> {
328329
.options('report-order', {
329330
type: 'string',
330331
description:
331-
'Comma-separated list of report types to specify the order in which reports should be displayed'
332+
'Comma-separated list of report types to specify the order in which reports should be displayed in the summary'
333+
})
334+
.options('folded', {
335+
type: 'string',
336+
description: 'Fold the folded reports in the summary (true/false)',
337+
choices: ['true', 'false', '']
332338
})
333339
.options('max-workflow-runs-to-check', {
334340
type: 'number',

src/core/inputs.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ export function getCliInputs(args: Arguments): Inputs {
5858
alwaysGroupBy: false,
5959
statusCheck: false,
6060
statusCheckName: 'GitHub Test Reporter Results',
61-
reportOrder
61+
reportOrder,
62+
folded: false
6263
}
6364
}
6465

@@ -140,6 +141,27 @@ export function getInputs(): Inputs {
140141
statusCheck: core.getInput('status-check').toLowerCase() === 'true',
141142
statusCheckName:
142143
core.getInput('status-check-name') || 'Test Reporter Results',
143-
reportOrder
144+
reportOrder,
145+
folded: processFoldedInput(core.getInput('folded'))
144146
}
145147
}
148+
149+
/**
150+
* Process the 'folded' input value, handling empty string, 'true', or 'false'
151+
*
152+
* @param foldedInput - The raw folded input value
153+
* @returns The processed value: true, false, or empty string
154+
*/
155+
function processFoldedInput(foldedInput: string): string | boolean {
156+
if (foldedInput === '') {
157+
return ''
158+
}
159+
160+
if (foldedInput.toLowerCase() === 'true') {
161+
return true
162+
} else if (foldedInput.toLowerCase() === 'false') {
163+
return false
164+
}
165+
166+
return foldedInput
167+
}

src/reports/test-table.hbs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
<details open >
12
| **Test Name** | **Status** | **Flaky** | **Duration** |
23
| --- | --- | --- | --- |
34
{{#slice ctrf.tests 0 8000}}
45
| {{name}} | {{getCtrfEmoji status}} | {{#if flaky}}{{getCtrfEmoji "flaky"}}{{/if}} | {{formatDurationMs duration}} |
5-
{{/slice}}
6+
{{/slice}}
7+
</details>

src/types/reporter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@ export interface Inputs {
4848
statusCheck: boolean
4949
statusCheckName: string
5050
reportOrder: string[]
51+
folded: string | boolean
5152
}

0 commit comments

Comments
 (0)