I have a github action to test the code coverage of unit tests written in JEST, and using Code Coverage Summary action to check the lines coverage to be between 60-80.
I get the following error when the job is run
Parsing Error: No package data found
tests.yml 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/[email protected]
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'
cobertura-coverage.xml file:
<?xml version="1.0" ?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage lines-valid="0" lines-covered="0" line-rate="NaN" branches-valid="0" branches-covered="0" branch-rate="NaN" timestamp="1661235506222" complexity="0" version="0.1">
<sources>
<source>C:\guardian group\c360-account-services</source>
</sources>
<packages>
</packages>
</coverage>
code coverage summary github action: https://github.com/marketplace/actions/code-coverage-summary