jest-coverage-report-action
jest-coverage-report-action copied to clipboard
stages.checkThreshold failed
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
Hi, same problem too!
- 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
Hi, same problem too!
Same problem here.
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
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 https://github.com/ArtiomTr/jest-coverage-report-action/issues/244#issuecomment-1097360277.
Now it works on my side
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?
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 sideHi @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",
}
...
@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