Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stages.checkThreshold failed #378

Open
hsnice16 opened this issue Jun 11, 2023 · 8 comments
Open

stages.checkThreshold failed #378

hsnice16 opened this issue Jun 11, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@hsnice16
Copy link

Describe a bug

I have added a coverageThreshold value to 0, but still stages.checkThreshold is failing

// package.json
{
   ...
     "jest": {
     ...
    "coverageThreshold": {
      "global": {
        "lines": 0
      }
    }
  }
}
// workflow
- name: 📝 Coverage Report
        uses: ArtiomTr/jest-coverage-report-action@v2
        with:
          coverage-file: ./apps/extension/coverage/coverage-final.json
          base-coverage-file: ./apps/extension/coverage/coverage-final.json
Screenshot 2023-06-11 at 1 56 49 PM
@hsnice16 hsnice16 added the bug Something isn't working label Jun 11, 2023
@osnoser1
Copy link

Hi, same problem too!
image

      - name: Publish coverage report
        uses: ArtiomTr/jest-coverage-report-action@v2
        with:
          skip-step: all
          coverage-file: ./coverage/coverage-final.json
          base-coverage-file: ./coverage/coverage-final.json

@thierryVerrier
Copy link

Hi, same problem too!

@AjaSharma93
Copy link

Same problem here.

@devinekadeni
Copy link

devinekadeni commented Aug 10, 2023

I also experiencing this, any update about this? @ArtiomTr

I even provide low threshold in the workflow file

with:
  threshold: 10

but seems no effect at all

@devinekadeni
Copy link

UPDATE:
after debugging on the source code turns out the problem was the generated coverage file have no coverageMap property.
This thread would explain everything #244 (comment).
Now it works on my side

@alisweatworks
Copy link

UPDATE: after debugging on the source code turns out the problem was the generated coverage file have no coverageMap property. This thread would explain everything #244 (comment). Now it works on my side

Hi @devinekadeni! I'm facing the same issue here. can you specify how did you make it work on your side?

@devinekadeni
Copy link

UPDATE: after debugging on the source code turns out the problem was the generated coverage file have no coverageMap property. This thread would explain everything #244 (comment). Now it works on my side

Hi @devinekadeni! I'm facing the same issue here. can you specify how did you make it work on your side?

@alisweatworks this is what I did on my workflow file

- name: Run test with coverage
   run: npm run test:coverage -- --json --outputFile="coverage/coverage-report.json"

- uses: ArtiomTr/jest-coverage-report-action@v2
   with:
     skip-step: all
     annotations: none 
     coverage-file: coverage/coverage-report.json
     base-coverage-file: coverage/coverage-report.json
// package.json
...
"scripts": {
    "test:coverage": "jest --coverage",
}
...

@alisweatworks
Copy link

alisweatworks commented Nov 29, 2023

@devinekadeni Thanks! I have the same thing only with yarn. My issue is that if I include a threshold in jest.config.ts, e.g.

  coverageThreshold : {
    global :{
      branches: 90,
      lines: 90,
      functions: 90,
      statements: 90
    }
  }

If my tests pass but don't meet the threshold, the job will fail with exit code 1 but the coverage report won't be generated (like shown here). I wonder what I'm doing wrong.

I see this in github logs:

...
...
Jest: "global" coverage threshold for statements (90%) not met: 86.22%
Jest: "global" coverage threshold for branches (90%) not met: 86.84%
Jest: "global" coverage threshold for lines (90%) not met: 85.39%
Jest: "global" coverage threshold for functions (90%) not met: 87.34%

Test Suites: 26 passed, 26 total
Tests:       182 passed, 182 total
Snapshots:   0 total
Time:        [39](https://github.com/SweatWorks/revenue-cycle-api/actions/runs/7033893498/job/19140703600#step:9:40).987 s
Test results written to: coverage/report.json
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

hence the next step which is coverage report wouldn't be triggered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants