Project info: Front End with JS/React
I have followed all the instructions to integrate sonarCloud scan with my front end project from this documentation
I followed everything through, the integration has been done successfully and I see sonarcloud being triggered on github actions.
However when I go to sonarCloud dashboard it is not being displayed.
I have an example of the projects we have on the screenshot: Project 1 displays the coverage, project 2 (the one I’ve been working on) does not display. And that’s what I’m trying to get:
I already double checked all the config added: I’ve added a sonar-project.properties file to the root that looks like this (update the info according to my organization):
I compared with what has been done to project 1, and what I did was exactly the same, but for project 2 doesn’t work.
I have added to .github/workflows/test.yml the additional sonarConfig:
So let’s assume for a moment that coverage is being imported correcty.
The only two ways to have null coverage reported would be
Zero Executable Lines (unlikely if your project has Javascript in it)
All files are being excluded from coverage.
Let’s consider the second for a moment. In your scanner logs you should have some logs like this, can you see if there are any files being marked as excluded sources for coverage?
Update: I merged this to our develop branch, once I did, the 0.0% appeared on sonar dashboard - At least some progress
But when I check the logs I still see the coverage pointing for jacoco. And I don’t get it why, since the path I passed is correct.
The JaCoco XML Report Importer will show up on every analysis despite what languages/analysis parameters are passed. But there should be a section specific to import of javascript LCOV reports.
@Colin to test a theory here, I added to the yml file - run: ls (after the action- run: yarn test:coverage)
and pushed the changes. With that I noticed that the the folder coverage was not created in the step before, and that’s why it’s null.
Then I manually deleted the folder coverage and ran yarn test:coverage -u
This way the folder is generated but we know that this is not the way.
It’s best if we stay focused on a single topic – let’s make sure that the Sensor JavaScript/TypeScript Coverage is running (that means that the scanner has identified a value is being passed to sonar.javascript.lcov.reportPaths) and then, once that’s taken care of, return to making sure the coverage report is generated in the right place (which is not much of a SonarCloud issue).
I’m a bit worried your sonar-project.properties file might be in a werid state, or that settings are being passed somewhere you aren’t aware of. For example, did you notice that here;
sonar.exclusions is tacked onto Excluded sources for coverage? That shouldn’t be happening.
Let me suggest this:
Please make sure that all values in your sonar-project.properties file are configured correctly, this means removing the spaces between <analysis paramter>= value and that each anlalysis parameter takes up one line (it looks like your second file for sonar.exclusions is on a new line)
Under project level Administration > Background Tasks, open up the SonarScanner context of an analysis that should have coverage reported and paste it here.
@Colin I update my sonar-project.properties file as you suggested. Making sure there are no spaces. Now it looks like this (I adjusted the sonar.sources only for src)
Hi Colin,
I have two repos, linked to two different Sonarcloud projects. Each project has the same configuration in SonarCloud. I’m using Bitbucket Pipelines to scan using this pipe (Bitbucket), pipeline YAML files are identical for both repos.
The backend project, where coverage works, has this in the Scanner Context:
Project server settings:
sonar.javascript.lcov.reportPaths=coverage/lcov.info
while the front end project, where the coverage does not work, is missing that line.
I would imagine that for the backend project, you have something set in the project level Administration > General Settings > Languages > Javascript/Typescript while for the latter project you don’t. It’s perfectly valid to set this either in the project administration or as an analysis parameter.
even though there is a configuration set up. So for both projects I see the same view in the Languages settings until I actually select Javascript/Typescript.