jest-coverage-report-action icon indicating copy to clipboard operation
jest-coverage-report-action copied to clipboard

Action reporting failed tests when no tests have failed

Open stretch0 opened this issue 2 years ago • 5 comments

Describe a bug

Action failing even when all tests and coverage has passed

Expected behavior

Would expect action to pass if test and code coverage have passed.

Details

  • Action version: v2
  • ubuntu-latest
  • action.yml file
    ```yml
    

name: Pull Request

on: [pull_request]

jobs: test: name: Run tests and linting runs-on: ubuntu-latest

steps:
  - name: Checkout
    uses: actions/checkout@v3
  - name: Setup Node.js
    uses: actions/setup-node@v3
    with:
      node-version: '16.x'
  - name: Authenticate with Github Package Registry
    run: npm config set '//npm.pkg.github.com/:_authToken' "${NPM_AUTH_TOKEN}"
    env:
      NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
  - name: Install dependencies
    run: npm ci
  - name: Run lint
    run: npm run lint
  - name: Type check
    run: npm run type-check
  - name: Configure AWS credentials
    uses: aws-actions/configure-aws-credentials@v1-node16
    with:
      aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
      aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      aws-region: eu-west-1
  - name: Get Base Coverage Report
    run: aws s3 cp s3://code-coverage-reports/gateway/report.json ./coverage/master/
  - name: Run Unit Tests
    if: github.actor != 'dependabot[bot]'
    uses: ArtiomTr/jest-coverage-report-action@v2
    with:
      base-coverage-file: ./coverage/master/report.json
      skip-step: install
  - uses: ahmadnassri/action-dependabot-auto-merge@v2
    with:
      target: patch
      github-token: ${{ secrets.DEPENDABOT_GITHUB_TOKEN }}

    ```

</details>
  • Screenshots

Test Suites: 1 skipped, 102 passed, 102 of 103 total Tests: 1 skipped, 210 passed, 211 total Snapshots: 2 passed, 2 total Time: 183.93 s Ran all test suites. Test results written to: report.json Running tests failed Error: Error: The process '/opt/hostedtoolcache/node/16.17.1/x64/bin/npx' failed with exit code 1 Error: The process '/opt/hostedtoolcache/node/16.17.1/x64/bin/npx' failed with exit code 1 at th._setResult (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:21:17898) at th.CheckComplete (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:21:17485) at ChildProcess. (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:21:16477) at ChildProcess.emit (node:events:513:28) at maybeClose (node:internal/child_process:1093:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

image

</details>

Additional context

It appears to throw an error at the following stage:

Error: Jest coverage report action failed
Error: Process completed with exit code 1.

This seems to be an intermittent issue but is happening majority of the time.

I thought maybe there was an issue with the base test coverage report but I have tried removing base-coverage-file: ./coverage/master/report.json so that it runs the tests against master branch and uses that to compare but the same error happens

stretch0 avatar Oct 27 '22 15:10 stretch0

Hello @stretch0 :wave:,

That's likely an issue with your tests. Although all tests succeed, jest can exit with a non-zero code for many reasons. For example:

  1. jest found a memory leak in your code, as you're not awaiting all promises
  2. thresholds were not passed.

I can't tell what's exactly going wrong, as I need to see the console output of your test suite run. Try to run all tests locally, and fix all warnings/messages. If that doesn't help, send me logs of your action run: image

ArtiomTr avatar Oct 27 '22 16:10 ArtiomTr

also faced with this issue. related to scheduler screen from logs image

ArkanRomanPango avatar Jan 23 '23 12:01 ArkanRomanPango

Running into same issue, anyone figure this out?

alexkev avatar Apr 30 '24 19:04 alexkev

Experiencing the same issue

kellyrmilligan avatar Jun 23 '24 20:06 kellyrmilligan