Support for Cobertura XML output
gnarvaja opened this issue · 2 comments
It would be good to have support for Cobertura XML output, as this is the the facto standard for output of many coverage tools and can be used to connect the output with CI plugins like https://github.com/insightsengineering/coverage-action.
A cobertura file looks more or less like this:
<class name="address_book.py" filename="src/eth_pretty_events/address_book.py" complexity="0" line-rate="0.7619" branch-rate="0.5">
<methods/>
<lines>
<line number="1" hits="1"/>
<line number="2" hits="1"/>
<line number="4" hits="1"/>
<line number="7" hits="1"/>
<line number="8" hits="1"/>
<line number="9" hits="1"/>
<line number="11" hits="0"/>
<line number="13" hits="1"/>
<line number="14" hits="1"/>
<line number="16" hits="0"/>
<line number="18" hits="1"/>
<line number="19" hits="1"/>
<line number="21" hits="0"/>
<line number="24" hits="1"/>
<line number="25" hits="1"/>
<line number="26" hits="0"/>
<line number="28" hits="1"/>
<line number="29" hits="0"/>
<line number="31" hits="1"/>
<line number="32" hits="0"/>
<line number="35" hits="1"/>
<line number="38" hits="1"/>
<line number="39" hits="1"/>
<line number="40" hits="1"/>
<line number="42" hits="1"/>
<line number="43" hits="0"/>
<line number="45" hits="1"/>
<line number="46" hits="1"/>
<line number="48" hits="1"/>
<line number="49" hits="0"/>
<line number="52" hits="1"/>
<line number="53" hits="1"/>
<line number="54" hits="0"/>
<line number="55" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="exit,exit"/>
<line number="58" hits="1"/>
<line number="59" hits="1"/>
<line number="60" hits="1"/>
<line number="61" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="64" hits="1"/>
<line number="66" hits="1"/>
<line number="69" hits="1"/>
<line number="71" hits="1"/>
</lines>
</class>
If you want I can send a PR, but I will need some clues on where to start to make the change.
@gnarvaja I think cobertura is already supported as a report type via the istanbulReporter
options array.
A complete list of output formats can be found here:
https://istanbul.js.org/docs/advanced/alternative-reporters
Could you see if configuring the plugin via .solcover.js
as below produces a usable coverage/cobertura-coverage.xml
?
// .solcover.js
module.exports = {
istanbulReporter: ["cobertura"]
};
Thanks, that worked fine, sorry for the noise...