- ALM used : GitHub
- CI system: Github Actions
- Languages of the repository: Javascript/Typescript
- Error observed:
We were wondering if we could get a bit of support understanding why the recently configured CI based analysis does not report coverage on PR creation. We have followed all the steps in the tutorial on Sonar Cube page. We have a Vue 2 project and our coverage report is generated by Jest for unit tests. We then send the lcov.info file to the CI based analysis in Github Actions. We can see in Sonar Cube’s page that the Overall Coverage and Coverage on New code for the master branch is reported but not for the develop branch or for any PRs. For most of the PRs we get 0 coverage on new Code, with the message: not enough lines to compute coverage.
Hey there!
Could you share a screenshot of your project dashboard that shows what you’re using? (More than 20 lines, but coverage conditions not applying)
Sure but can we use a private room for this?
Feel free to redact any data like branch names from the screenshot, but otherwise it shouldn’t contain any sensitive data. Read more about our policy on this here.
Thank you. I would like to mention that I have noticed an initial PR with coverage 100% where only one line of code is considered out of more added. Is there a place in the documentation where you specify what lines are considered when calculating coverage on new code? I will attach some screenshots of the Overview page in SonarQube Cloud.
Hey there.
Thanks for the screenshots, but I don’t see the message you mentioned!
In this PR for example we have 88 new lines but the Lines to Cover on New Code is 0. In this case the New Code was added to a .vue component.
Noticed also in other PRs that the Lines to Cover is a much lower number than the New Lines and was wondering if there is any documentation on exactly what counts as Lines to Cover on New Code in a Javascript project.
The coverage report that you pass to SonarQube determines which lines can be covered by code (the LCOV report indicates whether a line is covered or not covered). SonarQube does not make this determination itself, unless coverage data is completely absent for a file.
From what you’re sharing – everything looks as expected! You probably wouldn’t write tests for this code you’ve shared.
Try adding a new “executable line” (something that isn’t just a string, like declaring a new variable) and you should see SonarQube report on test coverage for that line.