saschanowak / clovercodecoveragesummary Goto Github PK
View Code? Open in Web Editor NEWA GitHub Action that reads Clover format code coverage files from your test suite and outputs a markdown summary
License: MIT License
A GitHub Action that reads Clover format code coverage files from your test suite and outputs a markdown summary
License: MIT License
First of all, thank you for this useful action, great job!
There is an issue when the codebase contains files that declare multiple classes. The clover.xml
will look something like the below:
<file name="{filePath}">
<class name="{class1}" namespace="global">
<metrics complexity="3" methods="3" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="6" coveredstatements="0" elements="9" coveredelements="0"/>
</class>
<class name="{class2}" namespace="global">
<metrics complexity="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</class>
<line num="17" type="method" name="xxx" visibility="public" complexity="1" crap="2" count="0"/>
.....
<metrics loc="43" ncloc="40" classes="1" methods="3" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="6" coveredstatements="0" elements="9" coveredelements="0"/>
</file>
That means a single <file>
element will have multiple <class>
children.
In that case, the parse will fail with ::error::Cannot read properties of undefined (reading '@_statements')
here
When using this github action I get the error:
Error: reportData.coverage.project.file is not iterable
"jest": "^27.0.0",
To generate the clover coverage report I'm running: jest --ci --coverage
which generates the folder in the root of my project
The workflow file:
permissions:
checks: write
contents: read
packages: read
pull-requests: write
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- uses: actions/cache@v3
with:
path: |
node_modules
~/.cache/Cypress
key: node-${{ hashFiles('yarn.lock') }}
- run: yarn --frozen-lockfile --check-files
- run: yarn test:ci
- name: Clover Code Coverage Summary
uses: saschanowak/[email protected]
with:
filename: ./coverage/clover.xml
- name: 'Add Code Coverage to Job Summary'
run: |
cat code-coverage-summary.md >> $GITHUB_STEP_SUMMARY
cat code-coverage-details.md >> $GITHUB_STEP_SUMMARY
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.