SonarQube Maven JEST code coverage shows 0%

  • SonarQube version → 8.9.1
    what I am trying to achieve:
    To get the code coverage metrics populated in the admin dashboard

what I have tried so far to achieve this
The project is automated with multi-module maven configuration as below,

Root
 | _Cat
      |_common
         |_tests    //Jest unit tests here
         |_style.css  //Both source code and test resides in the same dir common
         |_script.js
      |_pom.xml
| _Dog
      |_common
      |  |_tests    //Jest unit tests here
      |  |_style.css  //Both source code and test resides in the same dir common
      |  |_script.js
      |_pom.xml
|_pom.xml

I have added the following configuration in both module level pom.xml

<sonar.exclusions> jest, jquery.js</sonar.exclusions>
<sonar.test.inclusions>**/tests/*.js</sonar.test.inclusions>
<sonar.tests>${project.basedir}/common/tests</sonar.tests>
<sonar.coverage.exclusions> **/tests/**</sonar.coverage.exclusions>
<sonar.testExecutionReportPaths>test-report.xml</sonar.testExecutionReportPaths>

Following command is used to run mvn

mvn sonar:sonar -Dsonar.login=*****

But still I am seeing 0% for code coverage in the dashboard.

But the same is works as expected with sonar scanner with the property file.

Hi @Bala_Varadarajan ,

Welcome to SonarSource Community! :sonarsource:

Can you share your Scanner debug logs? Just append -X to the mvn command and show the logs here in a text file attachment.

Hello @Bala_Varadarajan

Did you manage to find a solution to your problem?