Skip to content

Commit

Permalink
Merge pull request #1268 from mikepenz/feature/1262
Browse files Browse the repository at this point in the history
Refine summary details
  • Loading branch information
mikepenz authored Dec 13, 2024
2 parents 731f74e + e257388 commit 62516aa
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 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
18 changes: 13 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

20 changes: 15 additions & 5 deletions src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@ 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 hasTests = testResults.some(testResult => testResult.totalCount > 0)

const passedHeader = hasTests ? (hasPassed ? (hasFailed ? 'Passed ☑️' : '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 +78,7 @@ export function buildSummaryTables(
annotation.status === 'success'
? '✅ pass'
: annotation.status === 'skipped'
? `⏭️ skipped`
? `⚠️️ skipped`
: `❌ ${annotation.annotation_level}`
}`
])
Expand Down Expand Up @@ -111,7 +121,7 @@ function appendDetailsTable(
annotation.status === 'success'
? '✅ pass'
: annotation.status === 'skipped'
? `⏭️ skipped`
? `⚠️️ skipped`
: `❌ ${annotation.annotation_level}`
}`
])
Expand Down

0 comments on commit 62516aa

Please sign in to comment.