Skip to content

Commit f90f8d4

Browse files
Fix/skipped test (#237)
* fix report conditionals to show skipped reports when pending tests exist * fix skipped tests display logic to include pending tests in summary
1 parent ae51c17 commit f90f8d4

File tree

11 files changed

+27
-23
lines changed

11 files changed

+27
-23
lines changed

__tests__/ctrf/report-preparation.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,20 @@ describe('addFooterDisplayFlags', () => {
382382
?.reportConditionals as ReportConditionals
383383
expect(reportConditionals.showSkippedReports).toBe(true)
384384
})
385+
386+
it('should show skipped reports when pending tests exist', () => {
387+
const report = createBaseReport()
388+
report.results.summary.pending = 1
389+
report.results.tests = [
390+
{ name: 'test1', status: 'pending', duration: 100 }
391+
]
392+
393+
addFooterDisplayFlags(report, createMultipleReportsInputs())
394+
395+
const reportConditionals = report.extra
396+
?.reportConditionals as ReportConditionals
397+
expect(reportConditionals.showSkippedReports).toBe(true)
398+
})
385399
})
386400

387401
describe('Measured Over Footer', () => {

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

dist/index.js

Lines changed: 2 additions & 1 deletion
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/skipped-table.hbs

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

dist/reports/summary-delta-table.hbs

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

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github-actions-ctrf",
3-
"version": "1.0.23",
3+
"version": "1.0.25",
44
"description": "View test results directly within your GitHub workflow summary and Pull Requests",
55
"main": "index.js",
66
"scripts": {

src/ctrf/report-conditionals.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ export function addFooterDisplayFlags(report: Report, inputs: Inputs): Report {
6767
0
6868

6969
const skippedThisRun = report.results.summary.skipped > 0
70+
const pendingThisRun = report.results.summary.pending > 0
7071

71-
if (skippedThisRun === false) {
72+
if (skippedThisRun === false && pendingThisRun === false) {
7273
const conditionals = report.extra.reportConditionals as ReportConditionals
7374
conditionals.includeSkippedReportCurrentFooter =
7475
isAnySkippedReportEnabled(inputs) && numOfReportsEnabled > 1

src/reports/skipped-table.hbs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
{{#if (filterOtherTests ctrf.tests)}}
22
| **Tests** | **Status** |
33
| --- | --- |
4-
{{#each ctrf.tests}}
5-
{{#if (eq status "skipped")}}
4+
{{#each (filterOtherTests ctrf.tests)}}
65
| {{name}} | {{status}} {{getCtrfEmoji status}} |
7-
{{else if (eq status "pending")}}
8-
| {{name}} | {{status}} {{getCtrfEmoji status}} |
9-
{{else if (eq status "other")}}
10-
| {{name}} | {{status}} {{getCtrfEmoji status}} |
11-
{{/if}}
126
{{/each}}
137
{{else}}
148
<p>No skipped tests ✨</p>

0 commit comments

Comments
 (0)