mirror of
https://github.com/dorny/test-reporter.git
synced 2026-02-01 02:45:22 -08:00
Fail the action if no test results are processed
This commit is contained in:
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@@ -40,7 +40,6 @@ jobs:
|
|||||||
needs: build-test
|
needs: build-test
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: sleep 60
|
|
||||||
- uses: ./
|
- uses: ./
|
||||||
with:
|
with:
|
||||||
artifact: test-results
|
artifact: test-results
|
||||||
|
|||||||
5
dist/index.js
generated
vendored
5
dist/index.js
generated
vendored
@@ -305,6 +305,11 @@ class TestReporter {
|
|||||||
core.setOutput('time', time);
|
core.setOutput('time', time);
|
||||||
if (this.failOnError && isFailed) {
|
if (this.failOnError && isFailed) {
|
||||||
core.setFailed(`Failed test has been found and 'fail-on-error' option is set to ${this.failOnError}`);
|
core.setFailed(`Failed test has been found and 'fail-on-error' option is set to ${this.failOnError}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (results.length === 0) {
|
||||||
|
core.setFailed(`No test results file has been processed`);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async createReport(parser, name, files) {
|
async createReport(parser, name, files) {
|
||||||
|
|||||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -123,6 +123,12 @@ class TestReporter {
|
|||||||
|
|
||||||
if (this.failOnError && isFailed) {
|
if (this.failOnError && isFailed) {
|
||||||
core.setFailed(`Failed test has been found and 'fail-on-error' option is set to ${this.failOnError}`)
|
core.setFailed(`Failed test has been found and 'fail-on-error' option is set to ${this.failOnError}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (results.length === 0) {
|
||||||
|
core.setFailed(`No test results file has been processed`)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user