Merge pull request #214 from trond-snekvik/fail-on-error

Only report failure if fail-on-error is set
This commit is contained in:
Michal Dorner 2022-11-30 18:14:08 +01:00 committed by GitHub
commit 75b0cadf5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

2
dist/index.js generated vendored
View file

@ -392,7 +392,7 @@ class TestReporter {
const summary = (0, get_report_1.getReport)(results, { listSuites, listTests, baseUrl, onlySummary });
core.info('Creating annotations');
const annotations = (0, get_annotations_1.getAnnotations)(results, this.maxAnnotations);
const isFailed = results.some(tr => tr.result === 'failed');
const isFailed = this.failOnError && results.some(tr => tr.result === 'failed');
const conclusion = isFailed ? 'failure' : 'success';
const icon = isFailed ? markdown_utils_1.Icon.fail : markdown_utils_1.Icon.success;
core.info(`Updating check run conclusion (${conclusion}) and output`);

View file

@ -9,7 +9,7 @@
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts",
"package": "ncc build --license licenses.txt && eolConverter lf dist/*",
"package": "ncc build --license licenses.txt && eolConverter lf 'dist/*'",
"test": "jest --ci --reporters=default --reporters=jest-junit",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test",
"dart-fixture": "cd \"reports/dart\" && dart test --file-reporter=\"json:../../__tests__/fixtures/dart-json.json\"",

View file

@ -174,7 +174,7 @@ class TestReporter {
core.info('Creating annotations')
const annotations = getAnnotations(results, this.maxAnnotations)
const isFailed = results.some(tr => tr.result === 'failed')
const isFailed = this.failOnError && results.some(tr => tr.result === 'failed')
const conclusion = isFailed ? 'failure' : 'success'
const icon = isFailed ? Icon.fail : Icon.success