{"id":13503305,"url":"https://github.com/dorny/test-reporter","last_synced_at":"2025-05-14T02:08:53.900Z","repository":{"id":37075303,"uuid":"300422142","full_name":"dorny/test-reporter","owner":"dorny","description":"Displays test results from popular testing frameworks directly in GitHub","archived":false,"fork":false,"pushed_at":"2025-03-25T19:15:00.000Z","size":16270,"stargazers_count":931,"open_issues_count":138,"forks_count":231,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-05-12T15:08:36.492Z","etag":null,"topics":["ci-cd","github-actions","reporting","testing"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dorny.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-10-01T20:53:23.000Z","updated_at":"2025-05-12T07:56:49.000Z","dependencies_parsed_at":"2024-01-02T21:29:08.782Z","dependency_job_id":"29c7bc1a-89e4-44ec-80cd-b055b2f314c9","html_url":"https://github.com/dorny/test-reporter","commit_stats":{"total_commits":355,"total_committers":40,"mean_commits":8.875,"dds":"0.47323943661971835","last_synced_commit":"1a288b62f8b75c0f433cbfdbc2e4800fbae50bd7"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":"actions/typescript-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorny%2Ftest-reporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorny%2Ftest-reporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorny%2Ftest-reporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorny%2Ftest-reporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dorny","download_url":"https://codeload.github.com/dorny/test-reporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254053208,"owners_count":22006717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci-cd","github-actions","reporting","testing"],"created_at":"2024-07-31T22:02:45.676Z","updated_at":"2025-05-14T02:08:48.874Z","avatar_url":"https://github.com/dorny.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Test Reporter\n\nThis [Github Action](https://github.com/features/actions) displays test results from popular testing frameworks directly in GitHub.\n\n✔️ Parses test results in XML or JSON format and creates nice report as GitHub Check Run or GitHub Actions job summaries\n\n✔️ Annotates code where it failed based on message and stack trace captured during test execution\n\n✔️ Provides final `conclusion` and counts of `passed`, `failed` and `skipped` tests as output parameters\n\n**How it looks:**\n|![](assets/fluent-validation-report.png)|![](assets/provider-error-summary.png)|![](assets/provider-error-details.png)|![](assets/mocha-groups.png)|\n|:--:|:--:|:--:|:--:|\n\n**Supported languages / frameworks:**\n- .NET / [dotnet test](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test#examples) ( [xUnit](https://xunit.net/) / [NUnit](https://nunit.org/) / [MSTest](https://github.com/Microsoft/testfx-docs) )\n- Dart / [test](https://pub.dev/packages/test)\n- Flutter / [test](https://pub.dev/packages/test)\n- Java / [JUnit](https://junit.org/)\n- JavaScript / [JEST](https://jestjs.io/) / [Mocha](https://mochajs.org/)\n- Swift / xUnit\n\nFor more information see [Supported formats](#supported-formats) section.\n\nDo you miss support for your favorite language or framework?\nPlease create [Issue](https://github.com/dorny/test-reporter/issues/new) or contribute with PR.\n\n## Example\n\nFollowing setup does not work in workflows triggered by pull request from forked repository.\nIf that's fine for you, using this action is as simple as:\n\n```yaml\non:\n  pull_request:\n  push:\npermissions:\n  contents: read\n  actions: read\n  checks: write\njobs:\n  build-test:\n    name: Build \u0026 Test\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4     # checkout the repo\n      - run: npm ci                   # install packages\n      - run: npm test                 # run tests (configured to use jest-junit reporter)\n\n      - name: Test Report\n        uses: dorny/test-reporter@v2\n        if: success() || failure()    # run this step even if previous step failed\n        with:\n          name: JEST Tests            # Name of the check run which will be created\n          path: reports/jest-*.xml    # Path to test results\n          reporter: jest-junit        # Format of test results\n```\n\n## Recommended setup for public repositories\n\nWorkflows triggered by pull requests from forked repositories are executed with read-only token and therefore can't create check runs.\nTo workaround this security restriction, it's required to use two separate workflows:\n1. `CI` runs in the context of the PR head branch with the read-only token. It executes the tests and uploads test results as a build artifact\n2. `Test Report` runs in the context of the repository main branch with read/write token. It will download test results and create reports\n\nThe second workflow will only run after it has been merged into your default branch (typically `main` or `master`), it won't run in a PR unless after the workflow file is part of that branch.\n\n**PR head branch:**  *.github/workflows/ci.yml*\n```yaml\nname: 'CI'\non:\n  pull_request:\njobs:\n  build-test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4         # checkout the repo\n      - run: npm ci                       # install packages\n      - run: npm test                     # run tests (configured to use jest-junit reporter)\n      - uses: actions/upload-artifact@v4  # upload test results\n        if: success() || failure()        # run this step even if previous step failed\n        with:\n          name: test-results\n          path: jest-junit.xml\n```\n**default branch:**  *.github/workflows/test-report.yml*\n```yaml\nname: 'Test Report'\non:\n  workflow_run:\n    workflows: ['CI']                     # runs after CI workflow\n    types:\n      - completed\npermissions:\n  contents: read\n  actions: read\n  checks: write\njobs:\n  report:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: dorny/test-reporter@v2\n      with:\n        artifact: test-results            # artifact name\n        name: JEST Tests                  # Name of the check run which will be created\n        path: '*.xml'                     # Path to test results (inside artifact .zip)\n        reporter: jest-junit              # Format of test results\n```\n\n## Usage\n\n```yaml\n- uses: dorny/test-reporter@v2\n  with:\n\n    # Name or regex of artifact containing test results\n    # Regular expression must be enclosed in '/'.\n    # Values from captured groups will replace occurrences of $N in report name.\n    # Example:\n    #   artifact: /test-results-(.*)/\n    #   name: 'Test report $1'\n    #   -\u003e Artifact 'test-result-ubuntu' would create report 'Test report ubuntu'\n    artifact: ''\n\n    # Name of the Check Run which will be created\n    name: ''\n\n    # Comma-separated list of paths to test results\n    # Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)\n    # All matched result files must be of the same format\n    path: ''\n\n    # The fast-glob library that is internally used interprets backslashes as escape characters.\n    # If enabled, all backslashes in provided path will be replaced by forward slashes and act as directory separators.\n    # It might be useful when path input variable is composed dynamically from existing directory paths on Windows.\n    path-replace-backslashes: 'false'\n\n    # Format of test results. Supported options:\n    #   dart-json\n    #   dotnet-nunit\n    #   dotnet-trx\n    #   flutter-json\n    #   java-junit\n    #   jest-junit\n    #   mocha-json\n    #   rspec-json\n    reporter: ''\n\n    # Allows you to generate only the summary.\n    # If enabled, the report will contain a table listing each test results file and the number of passed, failed, and skipped tests.\n    # Detailed listing of test suites and test cases will be skipped.\n    only-summary: 'false'\n\n    # Allows you to generate reports for Actions Summary\n    # https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/\n    use-actions-summary: 'true'\n\n    # Customize the title of badges shown for each Actions Summary.\n    # Useful when distinguish summaries for tests ran in multiple Actions steps.\n    badge-title: 'tests'\n\n    # Limits which test suites are listed:\n    #   all\n    #   failed\n    #   none\n    list-suites: 'all'\n\n    # Limits which test cases are listed:\n    #   all\n    #   failed\n    #   none\n    list-tests: 'all'\n\n    # Limits number of created annotations with error message and stack trace captured during test execution.\n    # Must be less or equal to 50.\n    max-annotations: '10'\n\n    # Set action as failed if test report contains any failed test\n    fail-on-error: 'true'\n\n    # Set this action as failed if no test results were found\n    fail-on-empty: 'true'\n\n    # Relative path under $GITHUB_WORKSPACE where the repository was checked out.\n    working-directory: ''\n\n    # Personal access token used to interact with Github API\n    # Default: ${{ github.token }}\n    token: ''\n```\n\n## Output parameters\n| Name       | Description              |\n| :--        | :--                      |\n| conclusion | `success` or `failure`   |\n| passed     | Count of passed tests    |\n| failed     | Count of failed tests    |\n| skipped    | Count of skipped tests   |\n| time       | Test execution time [ms] |\n| url        | Check run URL            |\n| url_html   | Check run URL HTML       |\n\n## Supported formats\n\n\u003cdetails\u003e\n  \u003csummary\u003edart-json\u003c/summary\u003e\n\nTest run must be configured to use [JSON](https://github.com/dart-lang/test/blob/master/pkgs/test/doc/configuration.md#reporter) reporter.\nYou can configure it in `dart_test.yaml`:\n\n```yml\nfile_reporters:\n  json: reports/test-results.json\n```\n\nOr with CLI arguments:\n\n[`dart test --file-reporter=\"json:test-results.json\"`](https://pub.dev/packages/test)\n\nFor more information see:\n- [test package](https://pub.dev/packages/test)\n- [test configuration](https://github.com/dart-lang/test/blob/master/pkgs/test/doc/configuration.md)\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003edotnet-trx\u003c/summary\u003e\n\nTest execution must be configured to produce *Visual Studio Test Results* files (TRX).\nTo get test results in TRX format you can execute your tests with CLI arguments:\n\n`dotnet test --logger \"trx;LogFileName=test-results.trx\"`\n\nOr you can configure TRX test output in `*.csproj` or `Directory.Build.props`:\n```xml\n\u003cPropertyGroup\u003e\n  \u003cVSTestLogger\u003etrx%3bLogFileName=$(MSBuildProjectName).trx\u003c/VSTestLogger\u003e\n  \u003cVSTestResultsDirectory\u003e$(MSBuildThisFileDirectory)/TestResults/$(TargetFramework)\u003c/VSTestResultsDirectory\u003e\n\u003c/PropertyGroup\u003e\n```\n\nSupported testing frameworks:\n- [xUnit](https://xunit.net/)\n- [NUnit](https://nunit.org/)\n- [MSTest](https://github.com/Microsoft/testfx-docs)\n\nFor more information see [dotnet test](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test#examples)\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eflutter-json\u003c/summary\u003e\n\nTest run must be configured to use [JSON](https://github.com/dart-lang/test/blob/master/pkgs/test/doc/configuration.md#reporter) reporter.\nYou can configure it in `dart_test.yaml`:\n```yml\nfile_reporters:\n  json: reports/test-results.json\n```\n\nOr with (undocumented) CLI argument:\n\n`flutter test --machine \u003e test-results.json`\n\n\nAccording to documentation `dart_test.yaml` should be at the root of the package, next to the package's pubspec.\nOn current `stable` and `beta` channels it doesn't work, and you have to put `dart_test.yaml` inside your `test` folder.\nOn `dev` channel, it's already fixed.\n\nFor more information see:\n- [test package](https://pub.dev/packages/test)\n- [test configuration](https://github.com/dart-lang/test/blob/master/pkgs/test/doc/configuration.md)\n- [flutter-cli](https://flutter.dev/docs/reference/flutter-cli)\n- [unit testing introduction](https://flutter.dev/docs/cookbook/testing/unit/introduction)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ejava-junit (Experimental)\u003c/summary\u003e\n\nSupport for [JUnit](https://Junit.org/) XML is experimental - should work but it was not extensively tested.\nTo have code annotations working properly, it's required your directory structure matches the package name.\nThis is due to the fact Java stack traces don't contain a full path to the source file.\nSome heuristic was necessary to figure out the mapping between the line in the stack trace and an actual source file.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ejest-junit\u003c/summary\u003e\n\n[JEST](https://jestjs.io/) testing framework support requires the usage of [jest-junit](https://github.com/jest-community/jest-junit) reporter.\nIt will create test results in Junit XML format which can be then processed by this action.\nYou can use the following example configuration in `package.json`:\n```json\n\"scripts\": {\n  \"test\": \"jest --ci --reporters=default --reporters=jest-junit\"\n},\n\"devDependencies\": {\n  \"jest\": \"^26.5.3\",\n  \"jest-junit\": \"^12.0.0\"\n},\n\"jest-junit\": {\n  \"outputDirectory\": \"reports\",\n  \"outputName\": \"jest-junit.xml\",\n  \"ancestorSeparator\": \" › \",\n  \"uniqueOutputName\": \"false\",\n  \"suiteNameTemplate\": \"{filepath}\",\n  \"classNameTemplate\": \"{classname}\",\n  \"titleTemplate\": \"{title}\"\n}\n```\n\nConfiguration of `uniqueOutputName`, `suiteNameTemplate`, `classNameTemplate`, `titleTemplate` is important for proper visualization of test results.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003emocha-json\u003c/summary\u003e\n\n[Mocha](https://mochajs.org/) testing framework support requires:\n- Mocha version [v7.2.0](https://github.com/mochajs/mocha/releases/tag/v7.2.0) or higher\n- Usage of [json](https://mochajs.org/#json) reporter.\n\nFor Mocha \u003e= [v9.1.0](https://github.com/mochajs/mocha/releases/tag/v9.1.0), you can use the following example configuration in `package.json`:\n```json\n\"scripts\": {\n  \"test\": \"mocha --reporter json --reporter-option output=test-results.json\"\n}\n```\n\nFor Mocha \u003c v9.1, the command should look like this:\n```json\n\"scripts\": {\n  \"test\": \"mocha --reporter json \u003e test-results.json\"\n}\n```\nAdditionally, test processing might fail if any of your tests write anything on standard output.\nBefore version [v9.1.0](https://github.com/mochajs/mocha/releases/tag/v9.1.0), Mocha doesn't have the option to store `json` output directly to the file, and we have to rely on redirecting its standard output ([mocha#4607](https://github.com/mochajs/mocha/pull/4607)).\nPlease update Mocha to version [v9.1.0](https://github.com/mochajs/mocha/releases/tag/v9.1.0) or above if you encounter this issue.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eswift-xunit (Experimental)\u003c/summary\u003e\n\nSupport for Swift test results in xUnit format is experimental - should work but it was not extensively tested.\n\u003c/details\u003e\n\n## GitHub limitations\n\nUnfortunately, there are some known issues and limitations caused by GitHub API:\n\n- Test report (i.e. Check Run summary) is markdown text. No custom styling or HTML is possible.\n- Maximum report size is 65535 bytes. Input parameters `list-suites` and `list-tests` will be automatically adjusted if max size is exceeded.\n- Test report can't reference any additional files (e.g. screenshots). You can use `actions/upload-artifact@v4` to upload them and inspect them manually.\n- Check Runs are created for specific commit SHA. It's not possible to specify under which workflow test report should belong if more\n  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.\n  For more information, see [#67](https://github.com/dorny/test-reporter/issues/67).\n\n## See also\n- [paths-filter](https://github.com/dorny/paths-filter) - Conditionally run actions based on files modified by PR, feature branch, or pushed commits\n\n## License\n\nThe scripts and documentation in this project are released under the [MIT License](https://github.com/dorny/test-reporter/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdorny%2Ftest-reporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdorny%2Ftest-reporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdorny%2Ftest-reporter/lists"}