We have two layers of testing over the same source files that produce two different lcov report files.
What I’m experiencing is that sonarcloud is not merging the coverages. I want to make sure this is expected behavior.
Just to ensure I’m clear let me illustrate with an oversimplified example:
example.js has two functions.
The first one is tested with our first layer of tests giving a coverage of 50%
The second one is tested with the second layer of tests with a coverage of 50%
My expectation would be to see 100% coverage in sonar but I see 50% (and only seems to be using the first lcov)
To add a bit more info. We are importing more than 2 lcov files (we have a mono repo) and It does pick up all of them as I have coverage for all my source files. This is the only case where two different layers of tests run over the same source files.
I’ve tried to merge the lcov files before sending them to sonar but the tools out there seem to be outdated and not doing the work well.
Just to make sure, you’re passing both coverage reports into analysis at the same time, right? You’re not passing in one and then re-analyzing with the second one, are you?
Same time yes. And again, it’s picking up all the report files, except in this specific case where two reports describe the coverage of the same files.
Yes, it’s a reasonable expectation. Double-checking the docs:
Wildcards and a comma-delimited list of paths are supported.
So, multiple reports are expected. (This can also be seen in the name of the parameter: sonar.javascript.lcov.reportPaths. Altho it would be reasonable to discount this, since some other parameter names are ransom-seeming.)
Well, but again. That’s not the same thing. Admitting multiple reports is not the same as sonar being able to merge reports that affect same files. I have not found anything in the documentation of sonar that says that it’s able of doing that.
We’ve had several reports working properly for a long time already. So that’s not where my question was headed anyways.
Can SonarCloud combine multiple test coverage files for the same source files in a way that increases the overall coverage beyond the coverage of each individual file?