mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-15 22:07:09 +01:00
add feature fail-on-empty
This commit is contained in:
parent
e9fa2f582c
commit
9e78da5e1b
4 changed files with 11 additions and 2 deletions
|
|
@ -158,6 +158,9 @@ jobs:
|
||||||
# Set action as failed if test report contains any failed test
|
# Set action as failed if test report contains any failed test
|
||||||
fail-on-error: 'true'
|
fail-on-error: 'true'
|
||||||
|
|
||||||
|
# Set this action as failed if no test results were found
|
||||||
|
fail-on-empty: 'true'
|
||||||
|
|
||||||
# Relative path under $GITHUB_WORKSPACE where the repository was checked out.
|
# Relative path under $GITHUB_WORKSPACE where the repository was checked out.
|
||||||
working-directory: ''
|
working-directory: ''
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,10 @@ inputs:
|
||||||
description: Set this action as failed if test report contain any failed test
|
description: Set this action as failed if test report contain any failed test
|
||||||
required: true
|
required: true
|
||||||
default: 'true'
|
default: 'true'
|
||||||
|
fail-on-empty:
|
||||||
|
description: Set this action as failed if no test results were found
|
||||||
|
required: true
|
||||||
|
default: 'true'
|
||||||
working-directory:
|
working-directory:
|
||||||
description: Relative path under $GITHUB_WORKSPACE where the repository was checked out
|
description: Relative path under $GITHUB_WORKSPACE where the repository was checked out
|
||||||
required: false
|
required: false
|
||||||
|
|
|
||||||
3
dist/index.js
generated
vendored
3
dist/index.js
generated
vendored
|
|
@ -293,6 +293,7 @@ class TestReporter {
|
||||||
this.listTests = core.getInput('list-tests', { required: true });
|
this.listTests = core.getInput('list-tests', { required: true });
|
||||||
this.maxAnnotations = parseInt(core.getInput('max-annotations', { required: true }));
|
this.maxAnnotations = parseInt(core.getInput('max-annotations', { required: true }));
|
||||||
this.failOnError = core.getInput('fail-on-error', { required: true }) === 'true';
|
this.failOnError = core.getInput('fail-on-error', { required: true }) === 'true';
|
||||||
|
this.failOnEmpty = core.getInput('fail-on-empty', { required: true }) === 'true';
|
||||||
this.workDirInput = core.getInput('working-directory', { required: false });
|
this.workDirInput = core.getInput('working-directory', { required: false });
|
||||||
this.onlySummary = core.getInput('only-summary', { required: false }) === 'true';
|
this.onlySummary = core.getInput('only-summary', { required: false }) === 'true';
|
||||||
this.token = core.getInput('token', { required: true });
|
this.token = core.getInput('token', { required: true });
|
||||||
|
|
@ -364,7 +365,7 @@ class TestReporter {
|
||||||
core.setFailed(`Failed test were found and 'fail-on-error' option is set to ${this.failOnError}`);
|
core.setFailed(`Failed test were found and 'fail-on-error' option is set to ${this.failOnError}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (results.length === 0) {
|
if (results.length === 0 && this.failOnEmpty) {
|
||||||
core.setFailed(`No test report files were found`);
|
core.setFailed(`No test report files were found`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ class TestReporter {
|
||||||
readonly listTests = core.getInput('list-tests', {required: true}) as 'all' | 'failed' | 'none'
|
readonly listTests = core.getInput('list-tests', {required: true}) as 'all' | 'failed' | 'none'
|
||||||
readonly maxAnnotations = parseInt(core.getInput('max-annotations', {required: true}))
|
readonly maxAnnotations = parseInt(core.getInput('max-annotations', {required: true}))
|
||||||
readonly failOnError = core.getInput('fail-on-error', {required: true}) === 'true'
|
readonly failOnError = core.getInput('fail-on-error', {required: true}) === 'true'
|
||||||
|
readonly failOnEmpty = core.getInput('fail-on-empty', {required: true}) === 'true'
|
||||||
readonly workDirInput = core.getInput('working-directory', {required: false})
|
readonly workDirInput = core.getInput('working-directory', {required: false})
|
||||||
readonly onlySummary = core.getInput('only-summary', {required: false}) === 'true'
|
readonly onlySummary = core.getInput('only-summary', {required: false}) === 'true'
|
||||||
readonly token = core.getInput('token', {required: true})
|
readonly token = core.getInput('token', {required: true})
|
||||||
|
|
@ -135,7 +136,7 @@ class TestReporter {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (results.length === 0) {
|
if (results.length === 0 && this.failOnEmpty) {
|
||||||
core.setFailed(`No test report files were found`)
|
core.setFailed(`No test report files were found`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue