Skip to content

Commit 62516aa

Browse files
authored
Merge pull request #1268 from mikepenz/feature/1262
Refine summary details
2 parents 731f74e + e257388 commit 62516aa

File tree

4 files changed

+31
-13
lines changed

4 files changed

+31
-13
lines changed

__tests__/table.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ const NORMAL_TABLE = [
2121
header: true
2222
},
2323
{
24-
data: 'Skipped ⏭️',
24+
data: 'Skipped',
2525
header: true
2626
},
2727
{
28-
data: 'Failed',
28+
data: 'Failed',
2929
header: true
3030
}
3131
],

dist/index.js

+13-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/table.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,23 @@ export function buildSummaryTables(
99
flakySummary: boolean,
1010
groupSuite = false
1111
): [SummaryTableRow[], SummaryTableRow[], SummaryTableRow[]] {
12+
// only include a warning icon if there are skipped tests
13+
const hasPassed = testResults.some(testResult => testResult.passed > 0)
14+
const hasSkipped = testResults.some(testResult => testResult.skipped > 0)
15+
const hasFailed = testResults.some(testResult => testResult.failed > 0)
16+
const hasTests = testResults.some(testResult => testResult.totalCount > 0)
17+
18+
const passedHeader = hasTests ? (hasPassed ? (hasFailed ? 'Passed ☑️' : 'Passed ✅') : 'Passed') : 'Passed ❌️'
19+
const skippedHeader = hasSkipped ? 'Skipped ⚠️' : 'Skipped'
20+
const failedHeader = hasFailed ? 'Failed ❌️' : 'Failed'
21+
1222
const table: SummaryTableRow[] = [
1323
[
1424
{data: '', header: true},
1525
{data: 'Tests', header: true},
16-
{data: 'Passed ✅', header: true},
17-
{data: 'Skipped ⏭️', header: true},
18-
{data: 'Failed ❌', header: true}
26+
{data: passedHeader, header: true},
27+
{data: skippedHeader, header: true},
28+
{data: failedHeader, header: true}
1929
]
2030
]
2131

@@ -68,7 +78,7 @@ export function buildSummaryTables(
6878
annotation.status === 'success'
6979
? '✅ pass'
7080
: annotation.status === 'skipped'
71-
? `⏭️ skipped`
81+
? `⚠️️ skipped`
7282
: `❌ ${annotation.annotation_level}`
7383
}`
7484
])
@@ -111,7 +121,7 @@ function appendDetailsTable(
111121
annotation.status === 'success'
112122
? '✅ pass'
113123
: annotation.status === 'skipped'
114-
? `⏭️ skipped`
124+
? `⚠️️ skipped`
115125
: `❌ ${annotation.annotation_level}`
116126
}`
117127
])

0 commit comments

Comments
 (0)