question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading a clover xml breaks on classes without lines

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ryanlukercommented, Nov 25, 2018
1reaction
ryanlukercommented, Oct 28, 2018

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found