Merge pull request #298 from dorny/main

Merge v1.7.0 to v1 branche
This commit is contained in:
Julien Catania 2023-10-09 19:48:22 +02:00 committed by GitHub
commit 1e3a380fe6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 2679 additions and 6604 deletions

View file

@ -11,6 +11,7 @@
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"import/no-named-as-default": "off",
"no-shadow": "off",
"no-unused-vars": "off",
"prefer-template": "off",
@ -60,29 +61,7 @@
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
// use <root>/path/to/folder/tsconfig.json
"project": "path/to/folder",
// Multiple tsconfigs (Useful for monorepos)
// use a glob pattern
"project": "packages/*/tsconfig.json",
// use an array
"project": [
"packages/module-a/tsconfig.json",
"packages/module-b/tsconfig.json"
],
// use an array of glob patterns
"project": [
"packages/*/tsconfig.json",
"other-packages/*/tsconfig.json"
]
"alwaysTryTypes": true // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
}
}
}

10
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

View file

@ -21,10 +21,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set Node.js 16.x
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3
with:
node-version: 16.x
@ -46,7 +46,7 @@ jobs:
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist

View file

@ -13,7 +13,7 @@ jobs:
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: node --version
- run: npm ci
- run: npm run build
@ -23,7 +23,7 @@ jobs:
- name: Upload test results
if: success() || failure()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: test-results
path: __tests__/__results__/*.xml

View file

@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: npm ci
- run: npm run build
- run: npm test

View file

@ -11,7 +11,7 @@ jobs:
name: Workflow test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ./
with:
artifact: test-results

View file

@ -1,5 +1,35 @@
# Changelog
## 1.7.0
* Fix #199: Use ✅ instead of ✔️ for better cross platform look by @petrdvorak in https://github.com/dorny/test-reporter/pull/200
* Verify content of dist/ folder matches build output by @dorny in https://github.com/dorny/test-reporter/pull/207
* Gracefully handle empty nested testsuite elements for JUnit. by @rvdlaarschot in https://github.com/dorny/test-reporter/pull/193
* Gracefully handle empty failure tags by @haudren-woven in https://github.com/dorny/test-reporter/pull/213
* Fix #208 - java-junit: show annotations on PR changed files by @atsu85 in https://github.com/dorny/test-reporter/pull/209
* Only report failure if fail-on-error is set by @trond-snekvik in https://github.com/dorny/test-reporter/pull/214
* Improve clarity on configuring for forkable repos by @abelbraaksma in https://github.com/dorny/test-reporter/pull/211
* Suppress "Processing test results from" log by @vasanthdharmaraj in https://github.com/dorny/test-reporter/pull/179
* Skip listing of files if error parsing is disabled by @dorny in https://github.com/dorny/test-reporter/pull/216
* Correct typo in docs by @tangowithfoxtrot in https://github.com/dorny/test-reporter/pull/254
* update dependencies by @j-catania in https://github.com/dorny/test-reporter/pull/269
* Add permissions to example yml files by @TurnrDev in https://github.com/dorny/test-reporter/pull/263
* add feature fail-on-empty by @gdams in https://github.com/dorny/test-reporter/pull/243
* Add dependabot configuration by @yeikel in https://github.com/dorny/test-reporter/pull/228
* Bump ws from 7.3.1 to 7.5.9 in /reports/jest by @dependabot in https://github.com/dorny/test-reporter/pull/265
* Bump actions/checkout from 2 to 4 by @dependabot in https://github.com/dorny/test-reporter/pull/279
* Add new output for url url html by @luisito666 in https://github.com/dorny/test-reporter/pull/242
* Update README.md by @IanMoroney in https://github.com/dorny/test-reporter/pull/158
* Update jest-Junit part of Readme by @ryancasburn-KAI in https://github.com/dorny/test-reporter/pull/176
* fix: default-valued fields are not mandatory by @TomerFi in https://github.com/dorny/test-reporter/pull/172
* Bump ansi-regex from 4.1.0 to 4.1.1 in /reports/jest by @dependabot in https://github.com/dorny/test-reporter/pull/278
* Bump decode-uri-component from 0.2.0 to 0.2.2 in /reports/jest by @dependabot in https://github.com/dorny/test-reporter/pull/276
* Bump minimist from 1.2.5 to 1.2.8 in /reports/jest by @dependabot in https://github.com/dorny/test-reporter/pull/275
* Bump qs from 6.5.2 to 6.5.3 in /reports/jest by @dependabot in https://github.com/dorny/test-reporter/pull/272
* Bump json5 from 2.1.3 to 2.2.3 in /reports/jest by @dependabot in https://github.com/dorny/test-reporter/pull/271
* Bump ansi-regex from 3.0.0 to 3.0.1 in /reports/mocha by @dependabot in https://github.com/dorny/test-reporter/pull/270
* declare 'url' and 'url_html' as action outputs by @micha-one in https://github.com/dorny/test-reporter/pull/287
* Avoid split on undefined by @cazou in https://github.com/dorny/test-reporter/pull/258
## v1.6.0
- [Update to node16 + recent versions of core and exec packages](https://github.com/dorny/test-reporter/pull/203)
- [Update all dependencies to latest versions](https://github.com/dorny/test-reporter/pull/186)

View file

@ -33,12 +33,16 @@ If that's fine for you, using this action is as simple as:
on:
pull_request:
push:
permissions:
contents: read
actions: read
checks: write
jobs:
build-test:
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 # checkout the repo
- uses: actions/checkout@v3 # checkout the repo
- run: npm ci # install packages
- run: npm test # run tests (configured to use jest-junit reporter)
@ -69,10 +73,10 @@ jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 # checkout the repo
- uses: actions/checkout@v3 # checkout the repo
- run: npm ci # install packages
- run: npm test # run tests (configured to use jest-junit reporter)
- uses: actions/upload-artifact@v2 # upload test results
- uses: actions/upload-artifact@v3 # upload test results
if: success() || failure() # run this step even if previous step failed
with:
name: test-results
@ -86,6 +90,10 @@ on:
workflows: ['CI'] # runs after CI workflow
types:
- completed
permissions:
contents: read
actions: read
checks: write
jobs:
report:
runs-on: ubuntu-latest
@ -116,7 +124,7 @@ jobs:
# Name of the Check Run which will be created
name: ''
# Coma separated list of paths to test results
# Comma-separated list of paths to test results
# Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)
# All matched result files must be of the same format
path: ''
@ -158,6 +166,9 @@ jobs:
# Set action as failed if test report contains any failed test
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.
working-directory: ''
@ -174,6 +185,8 @@ jobs:
| failed | Count of failed tests |
| skipped | Count of skipped tests |
| time | Test execution time [ms] |
| url | Check run URL |
| url_html | Check run URL HTML |
## Supported formats
@ -258,14 +271,14 @@ Some heuristic was necessary to figure out the mapping between the line in the s
</details>
<details>
<summary>jest-Junit</summary>
<summary>jest-junit</summary>
[JEST](https://jestjs.io/) testing framework support requires the usage of [jest-Junit](https://github.com/jest-community/jest-Junit) reporter.
[JEST](https://jestjs.io/) testing framework support requires the usage of [jest-junit](https://github.com/jest-community/jest-junit) reporter.
It will create test results in Junit XML format which can be then processed by this action.
You can use the following example configuration in `package.json`:
```json
"scripts": {
"test": "jest --ci --reporters=default --reporters=jest-Junit"
"test": "jest --ci --reporters=default --reporters=jest-junit"
},
"devDependencies": {
"jest": "^26.5.3",
@ -310,7 +323,7 @@ Unfortunately, there are some known issues and limitations caused by GitHub API:
- Test report (i.e. Check Run summary) is markdown text. No custom styling or HTML is possible.
- Maximum report size is 65535 bytes. Input parameters `list-suites` and `list-tests` will be automatically adjusted if max size is exceeded.
- Test report can't reference any additional files (e.g. screenshots). You can use `actions/upload-artifact@v2` to upload them and inspect them manually.
- Test report can't reference any additional files (e.g. screenshots). You can use `actions/upload-artifact@v3` to upload them and inspect them manually.
- Check Runs are created for specific commit SHA. It's not possible to specify under which workflow test report should belong if more
workflows are running for the same SHA. Thanks to this GitHub "feature" it's possible your test report will appear in an unexpected place in GitHub UI.
For more information, see [#67](https://github.com/dorny/test-reporter/issues/67).

View file

@ -11,7 +11,7 @@ inputs:
required: true
path:
description: |
Coma separated list of paths to test results
Comma-separated list of paths to test results
Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)
All matched result files must be of same format
required: true
@ -37,7 +37,7 @@ inputs:
Limits which test suites are listed. Supported options:
- all
- only-failed
required: true
required: false
default: 'all'
list-tests:
description: |
@ -45,16 +45,20 @@ inputs:
- all
- only-failed
- none
required: true
required: false
default: 'all'
max-annotations:
description: |
Limits number of created annotations with error message and stack trace captured during test execution.
Must be less or equal to 50.
required: true
required: false
default: '10'
fail-on-error:
description: Set this action as failed if test report contain any failed test
required: false
default: 'true'
fail-on-empty:
description: Set this action as failed if no test results were found
required: true
default: 'true'
working-directory:
@ -85,6 +89,10 @@ outputs:
description: Count of skipped tests
time:
description: Test execution time [ms]
url:
description: Check run URL
url_html:
description: Check run URL HTML
runs:
using: 'node16'
main: 'dist/index.js'

1044
dist/index.js generated vendored

File diff suppressed because it is too large Load diff

25
dist/licenses.txt generated vendored
View file

@ -696,31 +696,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
compress-brotli
MIT
The MIT License (MIT)
Copyright © 2019 Kiko Beats <josefrancisco.verdu@gmail.com> (kikobeats.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
decompress-response
MIT
MIT License

7980
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "test-check",
"version": "0.0.0",
"version": "1.7.0",
"private": true,
"description": "Presents test results from popular testing frameworks as Github check run",
"main": "lib/main.js",
@ -10,6 +10,7 @@
"format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts",
"package": "ncc build --license licenses.txt && eolConverter lf 'dist/*'",
"version": "npm run build && npm run package && git add 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\"",
@ -37,7 +38,7 @@
"fast-glob": "^3.2.5",
"got": "^11.8.2",
"picomatch": "^2.2.2",
"xml2js": "^0.4.23"
"xml2js": "^0.5.0"
},
"devDependencies": {
"@octokit/types": "^7.1.0",
@ -58,11 +59,12 @@
"eslint-plugin-github": "^4.1.2",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.8.3",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^28.1.3",
"jest-circus": "^28.1.3",
"jest-junit": "^14.0.0",
"js-yaml": "^4.1.0",
"prettier": "^2.7.1",
"prettier": "^3.0.0",
"ts-jest": "^28.0.8",
"typescript": "^4.7.4"
},

View file

@ -804,9 +804,9 @@
}
},
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true
},
"ansi-styles": {
@ -1343,9 +1343,9 @@
"dev": true
},
"decode-uri-component": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
"integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz",
"integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==",
"dev": true
},
"deep-is": {
@ -2546,9 +2546,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
"integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==",
"dev": true
},
"strip-ansi": {
@ -2908,13 +2908,10 @@
"dev": true
},
"json5": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
"integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
"dev": true
},
"jsprim": {
"version": "1.4.1",
@ -3080,9 +3077,9 @@
}
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"dev": true
},
"mixin-deep": {
@ -3486,9 +3483,9 @@
"dev": true
},
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
"integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==",
"dev": true
},
"react-is": {
@ -4660,9 +4657,9 @@
}
},
"ws": {
"version": "7.3.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz",
"integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==",
"version": "7.5.9",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
"integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
"dev": true
},
"xml": {

View file

@ -17,9 +17,9 @@
"dev": true
},
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true
},
"ansi-styles": {
@ -139,9 +139,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true
},
"is-fullwidth-code-point": {
@ -639,9 +639,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true
},
"is-fullwidth-code-point": {
@ -700,9 +700,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true
},
"is-fullwidth-code-point": {

View file

@ -4,7 +4,10 @@ import {FileContent, InputProvider, ReportInput} from './input-provider'
import {listFiles} from '../utils/git'
export class LocalFileProvider implements InputProvider {
constructor(readonly name: string, readonly pattern: string[]) {}
constructor(
readonly name: string,
readonly pattern: string[]
) {}
async load(): Promise<ReportInput> {
const result: FileContent[] = []

View file

@ -40,6 +40,7 @@ class TestReporter {
readonly listTests = core.getInput('list-tests', {required: true}) as 'all' | 'failed' | 'none'
readonly maxAnnotations = parseInt(core.getInput('max-annotations', {required: 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 onlySummary = core.getInput('only-summary', {required: false}) === 'true'
readonly token = core.getInput('token', {required: true})
@ -135,7 +136,7 @@ class TestReporter {
return
}
if (results.length === 0) {
if (results.length === 0 && this.failOnEmpty) {
core.setFailed(`No test report files were found`)
return
}
@ -198,6 +199,8 @@ class TestReporter {
core.info(`Check run create response: ${resp.status}`)
core.info(`Check run URL: ${resp.data.url}`)
core.info(`Check run HTML: ${resp.data.html_url}`)
core.setOutput('url', resp.data.url)
core.setOutput('url_html', resp.data.html_url)
return results
}

View file

@ -1,7 +1,11 @@
import {DEFAULT_LOCALE} from './utils/node-utils'
export class TestRunResult {
constructor(readonly path: string, readonly suites: TestSuiteResult[], private totalTime?: number) {}
constructor(
readonly path: string,
readonly suites: TestSuiteResult[],
private totalTime?: number
) {}
get tests(): number {
return this.suites.reduce((sum, g) => sum + g.tests, 0)
@ -40,7 +44,11 @@ export class TestRunResult {
}
export class TestSuiteResult {
constructor(readonly name: string, readonly groups: TestGroupResult[], private totalTime?: number) {}
constructor(
readonly name: string,
readonly groups: TestGroupResult[],
private totalTime?: number
) {}
get tests(): number {
return this.groups.reduce((sum, g) => sum + g.tests.length, 0)
@ -78,7 +86,10 @@ export class TestSuiteResult {
}
export class TestGroupResult {
constructor(readonly name: string | undefined | null, readonly tests: TestCaseResult[]) {}
constructor(
readonly name: string | undefined | null,
readonly tests: TestCaseResult[]
) {}
get passed(): number {
return this.tests.reduce((sum, t) => (t.result === 'success' ? sum + 1 : sum), 0)

View file

@ -19,6 +19,6 @@ export function parseIsoDate(str: string): Date {
}
export function getFirstNonEmptyLine(stackTrace: string): string | undefined {
const lines = stackTrace.split(/\r?\n/g)
return lines.find(str => !/^\s*$/.test(str))
const lines = stackTrace?.split(/\r?\n/g)
return lines?.find(str => !/^\s*$/.test(str))
}