From a3b45a8dbd3f8c371be9adef724835fe8ed90d50 Mon Sep 17 00:00:00 2001 From: Aart Jan Kaptijn Date: Tue, 23 Nov 2021 22:16:16 +0100 Subject: [PATCH] feat: auto set listsuites to failed --- src/report/get-report.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/report/get-report.ts b/src/report/get-report.ts index b95d04f..897cd05 100644 --- a/src/report/get-report.ts +++ b/src/report/get-report.ts @@ -44,6 +44,16 @@ export function getReport(results: TestRunResult[], options: ReportOptions = def } } + if (opts.listSuites === 'all') { + core.info("Test report summary is too big - setting 'listSuites' to 'failed'") + opts.listSuites = 'failed' + lines = renderReport(results, opts) + report = lines.join('\n') + if (getByteLength(report) <= MAX_REPORT_LENGTH) { + return report + } + } + core.warning(`Test report summary exceeded limit of ${MAX_REPORT_LENGTH} bytes and will be trimmed`) return trimReport(lines) } @@ -187,7 +197,7 @@ function getSuitesReport(tr: TestRunResult, runIndex: number, options: ReportOpt [Align.Left, Align.Right, Align.Right, Align.Right, Align.Right], ...suites.map((s, suiteIndex) => { const tsTime = formatTime(s.time) - const tsName = s.name.startsWith(name) ? s.name.slice(name.length) : s.name + const tsName = s.name.startsWith(name) ? s.name.slice(name.length + 1) : s.name const skipLink = options.listTests === 'none' || (options.listTests === 'failed' && s.result !== 'failed') const tsAddr = options.baseUrl + makeSuiteSlug(runIndex, suiteIndex).link const tsNameLink = skipLink ? tsName : link(tsName, tsAddr)