Fix edge case of one test assembly

This commit is contained in:
Ray Xu 2022-05-06 04:34:02 +00:00 committed by Zach Renner
parent 3608ee03fd
commit 724497a84c
14 changed files with 65 additions and 6 deletions

10
dist/index.js generated vendored
View file

@ -1595,7 +1595,12 @@ function getBadge(passed, failed, skipped, options) {
}
function getTestRunsReport(testRuns, options) {
const sections = [];
if (testRuns.length > 1 || options.onlySummary) {
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 > 0 || options.onlySummary) {
const tableData = testRuns
.filter(tr => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0)
.map(tr => {
@ -1613,6 +1618,9 @@ function getTestRunsReport(testRuns, options) {
const suitesReports = testRuns.map((tr, i) => getSuitesReport(tr, i, options)).flat();
sections.push(...suitesReports);
}
if (totalFailed === 0) {
sections.push(`</details>`);
}
return sections;
}
function getSuitesReport(tr, runIndex, options) {