Lcov.info vs SonarQUbe coverage mismatch

I am getting different results when I execute jest --coverage on my local vs what SonarQube dashboard displays. It feels like its completely ignore lcov.info file since from the logs I see that it is analyzing lcov.info file but somehow not respecting it as-is.

Any help is appreciated.

Thanks

Hi,

Welcome to the community!

I guess what SonarQube reports is lower than what the lcov report says?

 
Ann

Hello G Ann,

Thanks for reply. Yes its much lower but I can see its analyzing much more files.
But question is if SonarQube does its own stuff anyways then what’s the point of providing lcov.info?

Thanks

Hi,

That’s a fair question. For files that are included in your coverage report, that data is used and nothing extra happens on the SonarQube side. For files that aren’t included, what SonarQube does is calculate executable lines and include that in the denominator when the overall coverage is calculated. The full details are here in this blog post I wrote when we introduced the methodology.

 
HTH,
Ann

Hello G Ann,
Thanks for the reply. But this still leaves the question unanswered. I get that executable line analysis is the reason that SonarQube is doing this and an acceptable default behavior but when one provides LCOV report it means we don’t want sonarQube to be extra smart and just use the provided LCOV report. Simply put given an LCOV report SonarQube should respect it without trying to do extra.
But if SonarQube want to enforce the executable line analysis then at least display 2 coverage reports to make things little clear with one showing coverage from LCOV and then one with Executable lines logic.

Further, there should be a way to turn that feature off, so that it respects LCOV report as is.

Thanks