Sonar Scan not showing lines of code or coverage with Javascript/Typescript application

SonarScanner 4.8.0.2856

  • Using sonar-scanner configured with jest-sonar-reporter
  • SonarQube is deployed locally and via kitt build
  • I am trying to achieve coverage analysis on our application’s source code
  • So far I have updated sonar-project.properties file - mainly sonar.sources field - currently sonar scanner is only picking up sonar.test.inclusions and only reporting analysis on those test files. The files that we want to be analyzed have a flag in the log with a flag DEBUG: File not part of the project:

Hey there.

What version of SonarQube are you using? You can find this in the footer of your SonarQube instance.

Hi Colin thanks - we are using Version 9.9.1 (build 69595). I found that by adding the field for sonar.inclusions the analysis for lines displayed, however I am unclear of what changed, since it was reporting without needing sonar.inclusions. Here is an idea of what our sonar-project.properties looks like:


sonar.projectKey= 
sonar.projectName= 
sonar.projectVersion=1
sonar.verbose=true
sonar.sourceEncoding=UTF-8
sonar.host.url=
sonar.pullrequest.github.repository=
sonar.sources=src
sonar.verbose=true
sonar.tests=src
sonar.inclusions=src/**

# # Include test subdirectories in test scope

sonar.test.inclusions = 
sonar.exclusions=

Our Javascript/Typescript analyzer will try to work out what files belong to a project (and should be analyzed) based on things like your tsconfig.json file – is it possible you have one with some unexpected settings?

Thanks @Colin , it seemed to be an issue with the syntax of the sonar-project.properties file that needed an update to the sonar.inclusions property - which allowed the analysis to run. I am still trying to understand why this property was needed when analysis was previously executing without it. Any ideas?