Coverage dashboard not working 0%, for Javascript Files

Hello Team,

First of all thanks for your support,
I’ve been working all this week trying to get the Javascript Coverage configured for ts files, but i am stucked and is still showing 0 results %. Dont know what’s going on.
The Plugins i’ve installed for this are:

Sonar javascript plugin 3.2.0.5506.jar
SonarJS

Sonar typescript plugin 1.1.0.1079.jar
SonarTS

I am working with Jenkins who is the one coordinating everything and gradle for the build.

stage(‘Build’){
steps{
sh(script: ‘./gradlew -Pminify -PfeCoverage build’)

Find attached SonarQube parameters on my JenkinsFile attached.jenkins_test.txt (1.5 KB)

Also, what parameters should my gradle.build have to accomplish this setup?
Is the NpmTask a mandatory field? is configured ok?
I dont know what else could be missing.


task npmCoverage(type: NpmTask) {

  • dependsOn ‘npmInstall’*

  • execOverrides {*

  •    it.workingDir = 'src-webapp'*
    
  • }*

  • args = [‘run’, ‘test’, ‘–’, ‘–coverage’]*


Thanks in advance,

Hello @Christian_Alexis,

Before we can investigate in details, you have to upgrade both your JS and TS plugins to the most recent version compatible with your SonarQube version. And if you SonarQube version is older than 7.9, which I strongly suspect, you’ll have to upgrade your platform too (to 7.9 at least). It seems you are stuck in a version dating from Oct’ 2017. This is too old. So much have changed (improved) since then…

Once you have done the necessary upgrades, if it still does not work, please send me the logs of you pipeline, preferably run in debug (gradlew -d)

Also, just to be certain that this is not a side effect of you (apparently) using a (very) old scanner (The executable is called sonar-scanner and no longer sonar-runner since ages :-)), I need that you upgrade your scanner too, to the latest Scanner 4.5

Olivier

Hi Olivier! the Coverage after the updates its working now! thanks for your response!

Glad to read this. Enjoy!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.