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.

Invalid clover.xml

See original GitHub issue

šŸ› Bug Report

The generated clover.xml differs from the other reports.

To Reproduce

src/foo.js
function foo(a,b) {
    if (a === 0) {
        a = 1
    }
    if (b === 0) {
        b = 1
    }
    return a
}

module.exports = {foo}
src/foo.test.js
const { foo } = require("./foo")

it('tests condition for a', () => {
    expect(foo(0,0)).toEqual(1)
    expect(foo(2,0)).toEqual(2)
})
Run
$ yarn jest --coverage

Expected behavior

Report partial coverage for if (b === 0) { and full coverage for if (a === 0) {.

Actual behavior

Correct report on the cli, but wrong report in coverage/clover.xml

      <line num="2" count="2" type="cond" truecount="2" falsecount="0"/>
      <line num="5" count="2" type="cond" truecount="1" falsecount="1"/>

Link to repl or repo

https://repl.it/repls/RustyWanVariety

envinfo

System:
    OS: Linux 5.4 Debian GNU/Linux 9 (stretch) 9 (stretch)
    CPU: (4) x64 Intel(R) Xeon(R) CPU @ 2.30GHz
  Binaries:
    Node: 12.16.3 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  npmPackages:
    jest: ^24.9.0 => 24.9.0 

I got the same result with 26.1.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
jordanlevencommented, Nov 23, 2020

I noticed this as well - FWIW, the coverage-final.json file appears to be correct (in case youā€™re looking for a stop gap for reporting coverage to something like Codecov or Code Climate).

1reaction
coreyfarrellcommented, Nov 24, 2020

@SimenB it wouldnā€™t surprise me if the istanbul clover report is broken, I donā€™t think it is maintained. I wouldnā€™t know if a clover report is correct or not. Given the lack of understanding by istanbuljs and lack of automated testing Iā€™m not sure this situation will improve. Even accepting patches from the community is difficult due to lack of testing / understanding, I have no way of knowing if a patch is correct (doesnā€™t cause regressions for other clover users). The cobertura and teamcity reports are also in the same situation. Fixing mixed up branches might be a simpler fix but itā€™s hard to know. Assuming jest is not producing broken source-maps then I donā€™t see how this could be the fault of jest.

My personal recommendation for output to other systems is to use the lcovonly report to produce lcov output then use a tool provided by the other system to read the lcov. I donā€™t know these other systems but assume some tool must exist for reading lcov files (likely how they would read coverage from C projects built by gcc).

Read more comments on GitHub >

github_iconTop Results From Across the Web

php - Generating code coverage report in Clover XML format ...
I wanted to cover all the files, they were in src and in the root directory of the project. In the root directory...
Read more >
invalid XML character - CloverCARE Support - CloverDX
Hello! Unfortunately it seems that character 29 is really not valid for xml or used xml parser. You can try for example preprocess...
Read more >
Clover Results Collector looking for clover.xml in ... - Atlassian
With automatic integration, Clover Results Collector tries to find clover.xml in the wrong subdirectory in a job that involves an Ant taskĀ ...
Read more >
Failed to execute plugin 'Clover Results Collector' - OpenClover
3) Clover Results Collector tries to find an XML file in a wrong subdirectory (automatic integration). automatic Clover integration is enabledĀ ...
Read more >
FATAL error in the clover plugin stops processing of post-build ...
Problem: When the clover.xml file is invalid xml, the clover post-build action fails and stops the remaining post-build actions fromĀ ...
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