Fail the action if no test results are processed

This commit is contained in:
Michal Dorner 2021-02-18 21:18:04 +01:00
parent 93c3964547
commit 8efb156d28
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
4 changed files with 12 additions and 2 deletions

View file

@ -40,7 +40,6 @@ jobs:
needs: build-test
steps:
- uses: actions/checkout@v2
- run: sleep 60
- uses: ./
with:
artifact: test-results

5
dist/index.js generated vendored
View file

@ -305,6 +305,11 @@ class TestReporter {
core.setOutput('time', time);
if (this.failOnError && isFailed) {
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) {

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -123,6 +123,12 @@ class TestReporter {
if (this.failOnError && isFailed) {
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
}
}