Trying to run sonar-scanner from Desktop and include code coverage

Version of SonarQube: Community Edition 9.3

I am new to SonarQube, and am trying to do some tests on an existing Github repo. I found that the coverage is marked as 0, and learned this is because SonarQube does not run the tests on its own.

Here is what I tried:

  1. Clone the Github repo to my local.

  2. Create a project in SonarQube and install the sonar-scanner application to my desktop.

  3. Run the command:

sonar-scanner \
  -Dsonar.projectKey=sonarqube-project-name \
  -Dsonar.sources=. \
  -Dsonar.projectBaseDir=path/to/github/repo \ \

I think that I need to get the “yarn test:coverage” command output to get included in the SonarQube report so that coverage is not 0. Is there something simple I am missing? How can I do this?


Welcome to the community!

Sorry, but generating your coverage report is outside the scope of this community.


Is there any documentation on the website you can point me to? For example, in the above sonar-scanner command, is there some option I can add like a local directory on my desktop where the output of the yarn test:coverage command is stored?

I found there is one option “sonar.javascript.lcov.reportPaths” that can be used. That seems to include what I need.

I am now facing a new issue where my upload to SonarQube from the sonar-scanner tool gets timed out. I am creating a new thread for that.

1 Like