Skip to content

Commit

Permalink
- refine styling of summary tables
Browse files Browse the repository at this point in the history
  - FIX #1262
  • Loading branch information
mikepenz committed Dec 13, 2024
1 parent 731f74e commit 3e3f750
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions __tests__/table.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ const NORMAL_TABLE = [
header: true
},
{
data: 'Skipped ⏭️',
data: 'Skipped',
header: true
},
{
data: 'Failed',
data: 'Failed',
header: true
}
],
Expand Down
19 changes: 14 additions & 5 deletions src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ export function buildSummaryTables(
flakySummary: boolean,
groupSuite = false
): [SummaryTableRow[], SummaryTableRow[], SummaryTableRow[]] {
// only include a warning icon if there are skipped tests
const hasPassed = testResults.some(testResult => testResult.passed > 0)
const hasSkipped = testResults.some(testResult => testResult.skipped > 0)
const hasFailed = testResults.some(testResult => testResult.failed > 0)

const passedHeader = hasPassed ? (hasFailed ? 'Passed ☑️' : 'Passed ✅') : 'Passed'
const skippedHeader = hasSkipped ? 'Skipped ⚠️' : 'Skipped'
const failedHeader = hasFailed ? 'Failed ❌️' : 'Failed'

const table: SummaryTableRow[] = [
[
{data: '', header: true},
{data: 'Tests', header: true},
{data: 'Passed ✅', header: true},
{data: 'Skipped ⏭️', header: true},
{data: 'Failed ❌', header: true}
{data: passedHeader, header: true},
{data: skippedHeader, header: true},
{data: failedHeader, header: true}
]
]

Expand Down Expand Up @@ -68,7 +77,7 @@ export function buildSummaryTables(
annotation.status === 'success'
? '✅ pass'
: annotation.status === 'skipped'
? `⏭️ skipped`
? `⚠️️ skipped`
: `❌ ${annotation.annotation_level}`
}`
])
Expand Down Expand Up @@ -111,7 +120,7 @@ function appendDetailsTable(
annotation.status === 'success'
? '✅ pass'
: annotation.status === 'skipped'
? `⏭️ skipped`
? `⚠️️ skipped`
: `❌ ${annotation.annotation_level}`
}`
])
Expand Down

0 comments on commit 3e3f750

Please sign in to comment.