Sonar coverage report from jest fot react app

I have monorepo with below structure:

UI—at top lever

/ src – It contain all the source file

/Coverage → Lcov.info

Package.json

Sonar-project.properties

===============================================================

Sonar-projects.properties:

must be unique in a given SonarQube instance

#sonar.projectKey=my:project

sonar.projectKey=mb-ui-jenkins

— optional properties —

defaults to project key

#sonar.projectName=My project

defaults to ‘not provided’

#sonar.projectVersion=1.0

Path is relative to the sonar-project.properties file. Defaults to .

#sonar.sources=src

sonar.projectBaseDir=./src

Encoding of the source code. Default is default system encoding

#sonar.sourceEncoding=UTF-8

#sonar.exclusions=./node_modules/**

sonar.exclusions=/config/, /components/common/intEditor.js, /components/materialFlow/mineShipment/CellEditor.js, /testCases/

#sonar.scm.exclusions.disabled=false

Stage in jenkins file for sonarqube analysis:

          //To perform SonarQube Analysis

          stage ('SonarQube Analysis'){

    steps{

    dir('UI') {

          script{

          sh 'find . -name lcov.in

          withSonarQubeEnv('Sonarqube Prod') {                                                            

sh ‘${scannerHome}/bin/sonar-scanner -X -Dsonar.projectKey=mb-ui-jenkins --Dsonar.javascript.lcov.reportPaths=…/coverage/lcov.info’

                         }

                    }

          }

}

I tried to give coverage part Dsonar.javascript.lcov.reportPaths=…/coverage/lcov.info’

As src and coverage are at the same level with respect to UI. But it not able to parse the path which can be seen from Logs:

Sonarqube analysis logs:

[Pipeline] }

[Pipeline] // script

[Pipeline] }

[Pipeline] // stage

[Pipeline] stage

[Pipeline] { (SonarQube Analysis)

[Pipeline] dir

Running in /home/jenkins/workspace/Metals/Code-Build-UI-SonarUt/UI

[Pipeline] {

[Pipeline] script

[Pipeline] {

[Pipeline] sh

  • find . -name lcov.info

./coverage/lcov.info

[Pipeline] withSonarQubeEnv

Injecting SonarQube environment variables using the configuration: Sonarqube Prod

[Pipeline] {

[Pipeline] sh

  • /home/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarQube_4.3.0.2102/bin/sonar-scanner -X ‘-Dsonar.projectKey=mb-ui-jenkins’ ‘-Dsonar.login=1d19cc16f56c55b56afa50f8aef78e2a38ceda25’ ‘-Dsonar.javascript.lcov.reportPaths=…/coverage/lcov.info’

14:30:38.942 INFO: Sensor TypeScript analysis [javascript] (done) | time=96706ms

14:30:38.947 INFO: Sensor JavaScript/TypeScript Coverage [javascript]

14:30:38.948 INFO: Analysing [/home/jenkins/workspace/Metals/Code-Build-UI-SonarUt/UI/src/…/coverage/lcov.info]

14:30:39.124 WARN: Could not resolve 98 file paths in [/home/jenkins/workspace/Metals/Code-Build-UI-SonarUt/UI/src/…/coverage/lcov.info]

14:30:39.125 DEBUG: Unresolved path

I am trying to get coverge report on sonarqube dadhboard. But getting error as mentioned

Please help me on this… Thanks