From 108abd4de90c2f1705cfdc16e51fb7ccccb2508a Mon Sep 17 00:00:00 2001 From: "A. J. Kaptijn" Date: Wed, 24 Jan 2024 09:13:51 +0100 Subject: [PATCH] print the first 10 failed tests --- dist/index.js | 19 +++++++++++++++++++ src/main.ts | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/dist/index.js b/dist/index.js index f7a4d66..cbad7b5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -192,6 +192,7 @@ class TestReporter { } } run() { + var _a; return __awaiter(this, void 0, void 0, function* () { if (this.workDirInput) { core.info(`Changing directory to '${this.workDirInput}'`); @@ -258,6 +259,24 @@ class TestReporter { core.setOutput('time', time); if (results.some(r => r.shouldFail)) { core.setFailed(`Failed test were found and the results could not be written to github, so fail this step.`); + let counter = 0; + core.startGroup('Failed tests'); + for (const r of results.filter(r => r.shouldFail)) { + for (const rr of r.results) { + for (const s of rr.failedSuites) { + for (const g of s.failedGroups) { + for (const t of g.failedTests) { + if (++counter > 10) { + core.endGroup(); + return; + } + core.info(`${t.name}: ${(_a = t.error) === null || _a === void 0 ? void 0 : _a.message}`); + } + } + } + } + } + core.endGroup(); return; } if (this.failOnError && isFailed) { diff --git a/src/main.ts b/src/main.ts index 84d8a46..d3e32c0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -157,6 +157,27 @@ class TestReporter { if (results.some(r => r.shouldFail)) { core.setFailed(`Failed test were found and the results could not be written to github, so fail this step.`) + + let counter = 0 + core.startGroup('Failed tests') + for (const r of results.filter(r => r.shouldFail)) { + for (const rr of r.results) { + for (const s of rr.failedSuites) { + for (const g of s.failedGroups) { + for (const t of g.failedTests) { + if (++counter > 10) { + core.endGroup() + return + } + + core.info(`${t.name}: ${t.error?.message}`) + } + } + } + } + } + + core.endGroup() return }