Loading a clover xml breaks on classes without lines
See original GitHub issueI was having an issue with clover xml files I generated with phpunit sometimes failing to load:
[1539175884820][coverageservice]: Loading 1 file(s)
[1539175884824][lcovparser][clover-parse]: Error: Cannot read property 'forEach' of undefined
[1539175884824][lcovparser][clover-parse]: Stacktrace: TypeError: Cannot read property 'forEach' of undefined
For me this happens on cases like this, where there’s a class with no lines:
<file name="/app/Models/Scenario.php">
<class name="App\Models\Scenario" namespace="App\Models">
<metrics complexity="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</class>
<metrics loc="10" ncloc="10" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</file>
I think I’ve already found the issue and made a pull request at cvrg-report/clover-json#1 to fix my issue, but I still wanted to report it here in case anyone else using this plugin is having this same issue. If the issue is fixed in clover-json I can make a pull request to update that package in here.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Failed to execute plugin 'Clover Results Collector'
Failed to execute plugin 'Clover Results Collector' ; 1) Build has failed causing that not all Clover's goals have been called. the " ......
Read more >Generating code coverage report in Clover XML format ... PHP ...
Generating code coverage report in Clover XML format ... PHP Fatal error: Cannot declare class ..., because the name is already in use...
Read more >Error while loading data in the Database - support for CloverDX
Means error should be logged in the file and the rest of the data should be loaded in the database. Error coming in...
Read more >Coverage-clover xml <file> tags `name` attribute's file path's ...
The problem I am having is the paths in the clover.xml file phpunit is generating break as soon as I include/require anything from...
Read more >Part 1 - Measuring Coverage - OpenClover 4.2
Compiling and running. In this step we will compile the library and run the tests against it without using Clover to check that...
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
@koole thanks for the reminder! this will be included in the 2.3.0 release https://github.com/ryanluker/vscode-coverage-gutters/commit/c9870a1154b1545da23eecb45ab7c1cd84bf3ead
@koole FYI, I am hoping to include this fix in the 2.3.0 release (weeks away) so we will either have to use the commit hash of your fork or hopefully just increment the module version if the maintainer gets to that npm release.