Not working with JEST
See original GitHub issueI am using JEST for testing and I am generating the coverage report in cobertura format, and this error shows up when the workflow is run.
Coverage File: /github/workspace/coverage/cobertura-coverage.xml
Parsing Error: No package data found - /github/workspace/coverage/cobertura-coverage.xml
yml workflow file:
name: Node tests (with coverage)
on:
push:
branches:
- '*'
- '!master'
- '!SS-test'
- '!SS-UAT-test'
- '!PS-prod'
pull_request:
branches:
- 'master'
jobs:
unit_tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install npm packages
run: npm ci
- name: Test
run: npm run test:coverage
- name:
uses: actions/upload-artifact@v3
with:
name: my-artifact
path: "coverage/" # or path/to/artifact
- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: "/coverage/cobertura-coverage.xml"
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'
could someone please help me figure out whats going wrong
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Troubleshooting
Troubleshooting. Uh oh, something went wrong? Use this guide to resolve issues with Jest. Tests are Failing and You Don't Know Why.
Read more >javascript - Jest command not recognized
2) Install locally · If any of the above don't work, try reinstalling jest . · If it still doesn't work, try removing...
Read more >Troubleshooting · Jest
Try running Jest with --no-watchman or set the watchman configuration option to false . Also see watchman troubleshooting. Tests are Extremely Slow on...
Read more >[Bug]: jest.mock not working with ESM support activated ...
This pattern worked with CJS, because babel-jest transformer is moving jest.mock calls at the top of the file (above any require statement).
Read more >How to fix Jest and Mock Service Worker integration errors
This time it is complaining that in jest.setup.js file above I used import . The fix for this was quite easy, I rename...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I ran into this myself.
If you remove the
test
command from thepackage.json
in the package with no tests then lerna/nx will not run the command in that package… And so you get no coverage files for that package.Not ashamed to say, it took me far too long to think of this “workaround”
Hey @BeyondEvil , I realized this after a bit of research, If you are using JEST, we can set coverage threshold and we don’t need a github action.
take a look at this: https://jestjs.io/docs/configuration#coveragethreshold-object
Thank You