mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
print the first 10 failed tests
This commit is contained in:
parent
a3bd4352e9
commit
108abd4de9
2 changed files with 40 additions and 0 deletions
19
dist/index.js
generated
vendored
19
dist/index.js
generated
vendored
|
|
@ -192,6 +192,7 @@ class TestReporter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
run() {
|
run() {
|
||||||
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (this.workDirInput) {
|
if (this.workDirInput) {
|
||||||
core.info(`Changing directory to '${this.workDirInput}'`);
|
core.info(`Changing directory to '${this.workDirInput}'`);
|
||||||
|
|
@ -258,6 +259,24 @@ class TestReporter {
|
||||||
core.setOutput('time', time);
|
core.setOutput('time', time);
|
||||||
if (results.some(r => r.shouldFail)) {
|
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.`);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (this.failOnError && isFailed) {
|
if (this.failOnError && isFailed) {
|
||||||
|
|
|
||||||
21
src/main.ts
21
src/main.ts
|
|
@ -157,6 +157,27 @@ class TestReporter {
|
||||||
|
|
||||||
if (results.some(r => r.shouldFail)) {
|
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.`)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue