mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Fail (optionally) the action if test report contains any failed test
This commit is contained in:
parent
1ee2707b1a
commit
94e768fc01
4 changed files with 13 additions and 1 deletions
|
|
@ -8,6 +8,10 @@ description: |
|
||||||
|
|
||||||
author: 'Michal Dorner <dorner.michal@gmail.com>'
|
author: 'Michal Dorner <dorner.michal@gmail.com>'
|
||||||
inputs:
|
inputs:
|
||||||
|
fail-on-error:
|
||||||
|
description: 'Set this action as failed if test report contains any failed test'
|
||||||
|
required: true
|
||||||
|
default: 'true'
|
||||||
name:
|
name:
|
||||||
description: 'Name of the check run'
|
description: 'Name of the check run'
|
||||||
required: true
|
required: true
|
||||||
|
|
|
||||||
4
dist/index.js
generated
vendored
4
dist/index.js
generated
vendored
|
|
@ -41,6 +41,7 @@ async function run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function main() {
|
async function main() {
|
||||||
|
const failOnError = core.getInput('fail-on-error', { required: true }) === 'true';
|
||||||
const name = core.getInput('name', { required: true });
|
const name = core.getInput('name', { required: true });
|
||||||
const path = core.getInput('path', { required: true });
|
const path = core.getInput('path', { required: true });
|
||||||
const reporter = core.getInput('reporter', { required: true });
|
const reporter = core.getInput('reporter', { required: true });
|
||||||
|
|
@ -60,6 +61,9 @@ async function main() {
|
||||||
...github.context.repo
|
...github.context.repo
|
||||||
});
|
});
|
||||||
core.setOutput('conclusion', conclusion);
|
core.setOutput('conclusion', conclusion);
|
||||||
|
if (failOnError && !result.success) {
|
||||||
|
core.setFailed(`Failed test has been found and 'fail-on-error' option is set to ${failOnError}.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function getParser(reporter) {
|
function getParser(reporter) {
|
||||||
switch (reporter) {
|
switch (reporter) {
|
||||||
|
|
|
||||||
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
|
|
@ -14,6 +14,7 @@ async function run(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
|
const failOnError = core.getInput('fail-on-error', {required: true}) === 'true'
|
||||||
const name = core.getInput('name', {required: true})
|
const name = core.getInput('name', {required: true})
|
||||||
const path = core.getInput('path', {required: true})
|
const path = core.getInput('path', {required: true})
|
||||||
const reporter = core.getInput('reporter', {required: true})
|
const reporter = core.getInput('reporter', {required: true})
|
||||||
|
|
@ -37,6 +38,9 @@ async function main(): Promise<void> {
|
||||||
})
|
})
|
||||||
|
|
||||||
core.setOutput('conclusion', conclusion)
|
core.setOutput('conclusion', conclusion)
|
||||||
|
if (failOnError && !result.success) {
|
||||||
|
core.setFailed(`Failed test has been found and 'fail-on-error' option is set to ${failOnError}.`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParser(reporter: string): ParseTestResult {
|
function getParser(reporter: string): ParseTestResult {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue