mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Fix edge case of one test assembly
This commit is contained in:
parent
3608ee03fd
commit
724497a84c
14 changed files with 65 additions and 6 deletions
|
|
@ -143,8 +143,13 @@ function getBadge(passed: number, failed: number, skipped: number, options: Repo
|
|||
|
||||
function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): string[] {
|
||||
const sections: string[] = []
|
||||
const totalFailed = testRuns.reduce((sum, tr) => sum + tr.failed, 0)
|
||||
if (totalFailed === 0) {
|
||||
sections.push(`<details><summary>Expand for details</summary>`)
|
||||
sections.push(` `)
|
||||
}
|
||||
|
||||
if (testRuns.length > 1 || options.onlySummary) {
|
||||
if (testRuns.length > 0 || options.onlySummary) {
|
||||
const tableData = testRuns
|
||||
.filter(tr => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0)
|
||||
.map(tr => {
|
||||
|
|
@ -168,6 +173,10 @@ function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): s
|
|||
const suitesReports = testRuns.map((tr, i) => getSuitesReport(tr, i, options)).flat()
|
||||
sections.push(...suitesReports)
|
||||
}
|
||||
|
||||
if (totalFailed === 0) {
|
||||
sections.push(`</details>`)
|
||||
}
|
||||
return sections
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue