Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) – Sonar Qube enterprise edition
- how is SonarQube deployed: zip, Docker, Helm
- what are you trying to achieve - To increase the new code coverage
- what have you tried so far to achieve this - To write jest unit test case
Welcome to the community!
You’ve given us very little to go on here, but maybe that’s okay because SonarQube only reads the reports you pass in to analysis. So your first step is to make sure the coverage your new tests add is reflected in the Jest report.
If they are, then feel free to come back to us with
- your SonarQube version (check the page footer if you’re unsure)
- your analysis logs
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.
This guide will help you find them.
Hello G Ann Campbell
Thank you for your response.
SonarQube Version - Enterprise Edition Version 9.9 (build 65466)
For privacy reasons I can’t share the complete log. May be I will try later to share
What I want to understand is that we are mentioning the lcov report paths in sonar.properties file, do we still need another property such as testExecutionReportPaths. Also do we need any additional dependency in our project which can show reports on Sonar?
JFYI - for now we are using “jest-sonar-reporter”
Thanks & Regards,
Feel free to redact your logs as necessary.
Each parameter provides different information to analysis. The LCov report parameter provides a coverage report. A test execution report parameter would provide information on test count and test success/failure. You don’t need to provide execution information to have your coverage reflected in SonarQube.
I can see that there is a problem coming for lcov path resolution. There are logs around it which mentions that few paths have not been resolved, there are inconsistencies in the file.
Found inconsistencies in coverage report.
We are specifying the lcov path in sonar properties file as <folder_name_for_coverage>/lcov.info
What could wrong here?
I don’t understand the question.
You’ve already noted that the logs are telling you that some files mentioned in the coverage report aren’t found during analysis. You also say
Those are the things you need to be working on.
The problem is that we have been trying to increase the new code coverage report for which jest test cases have also been written.
In local we see pretty much very good report, but on Sonar we face a huge decline. Therefore we were trying to investigate the plugins used for sonar reports.
Not sure what is wrong there with Sonar, if you can pinpoint the cause, that would be really helpful
I would start with this:
Figure out why the paths to those file that analysis sees are different than the paths in the coverage report.
After resolving the WARNING on unresolved path I see below in logs -
Problem during processing LCOV report: can't save BRDA data for line 29 of coverage report file (java.lang.IllegalArgumentException: Line with number 61 doesn't belong to file ABC.vue).
These are repetitive and at the end it says 111 inconsistencies found in the report.
Do you have any suggestions around this?
Thanks & Regards
Let’s start with the basics. Can you look at at least a few of those inconsistencies and verify whether or not they make sense? For example,
ABC.vue have a line 61?
First of all sorry for the late response.
No we don’t have line 61 in ABC.vue file. Also we are not sure how that information is coming lcov.info as this file is automatically generated by Jest.
This is something may be we need to fix before. If you have any idea around this, that would be highly appreciated.
We are also checking this from our end, will keep you posted if found something.
Thanks & Regards
Sorry, but I’m not going to be able to help on this.