Showing 0% coverage for type script projects despite of having coberturaCoverage.xml

I can see generated coverage and files analyzed in Jenkins logs but not showing on sonar dashboard.
here is my logs:

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 77.78 20 41.67 77.14
src 74.07 20 50 75.51
application.ts 100 0 100 100 18
index.ts 26.67 14.29 0 26.67 6-14,19-37
sequence.ts 87.5 50 66.67 94.74 42
src/controllers 85.19 100 33.33 80.95
healthy.controller.ts 77.78 100 0 71.43 26,36
ping.controller.ts 100 100 100 100
ready.controller.ts 77.78 100 0 71.43 26,36
------------------------ --------- ---------- --------- --------- -------------------
=============================== Coverage summary ===============================
Statements   : 77.78% ( 63/81 )
Branches     : 20% ( 2/10 )
Functions    : 41.67% ( 5/12 )
Lines        : 77.14% ( 54/70 )
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (integration_test)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (sonar-scan)
[Pipeline] echo
Inside /opt/IBM/sonar-scanner
[Pipeline] fileExists
[Pipeline] echo
File  found
[Pipeline] sh (sonar-scanner)
+ set +x
INFO: Scanner configuration file: /home/tools/sonar-scanner/conf/
INFO: Project root configuration file: /home/lcuser/jenkins/workspace/late-loopback4_code_coverage_POC/
INFO: SonarQube Scanner
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Linux 5.4.0-1037-aws amd64
INFO: User cache: /home/lcuser/.sonar/cache
INFO: SonarQube server 8.7.1
INFO: Default locale: "en", source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=75ms
INFO: Server id: 86E1FA4D-AXQ3zeL1owuuLi4magzJ
INFO: User cache: /home/lcuser/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=43ms
INFO: Load/download plugins (done) | time=385ms
INFO: Process project properties
INFO: Process project properties (done) | time=8ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=2ms
INFO: Project key: template-loopback4
INFO: Base dir: /home/lcuser/jenkins/workspace/late-loopback4_code_coverage_POC
INFO: Working dir: /home/lcuser/jenkins/workspace/late-loopback4_code_coverage_POC/.scannerwork
INFO: Load project settings for component key: 'template-loopback4'
INFO: Load project settings for component key: 'template-loopback4' (done) | time=14ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=36ms
INFO: Auto-configuring with CI 'Jenkins'
INFO: Load active rules
INFO: Load active rules (done) | time=553ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: node_modules/**/*, coverage/**/*, src/_tests_/acceptance/*.ts, src/_tests_/acceptance/*.ts
INFO:   Included tests: src/_tests_/acceptance/*.ts
INFO:   Excluded sources for coverage: node_modules/**/*, coverage/**/*, src/_tests_/acceptance/*.ts
INFO: 18 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for ts: Sonar way
INFO: ------------- Run sensors on module template-loopback4
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=21ms
INFO: Sensor CSS Rules [cssfamily]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor CSS Rules [cssfamily] (done) | time=1ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms
INFO: Sensor TypeScript analysis [javascript]
INFO: Found 1 tsconfig.json file(s): [/home/lcuser/jenkins/workspace/late-loopback4_code_coverage_POC/tsconfig.json]
INFO: 12 source files to be analyzed
INFO: Analyzing 12 files using tsconfig: /home/lcuser/jenkins/workspace/late-loopback4_code_coverage_POC/tsconfig.json
INFO: Load project repositories
INFO: Load project repositories (done) | time=22ms
INFO: 12/12 source files have been analyzed
INFO: Sensor TypeScript analysis [javascript] (done) | time=17924ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=2ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=1ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=3ms
INFO: Sensor SonarTS [typescript]
INFO: Since SonarTS v2.0, TypeScript analysis is performed by SonarJS analyzer v6.0 or later. No TypeScript analysis is performed by SonarTS.
INFO: Sensor SonarTS [typescript] (done) | time=0ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=1ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=24ms
INFO: CPD Executor 1 file had no CPD blocks
INFO: CPD Executor Calculating CPD for 11 files
INFO: CPD Executor CPD calculation finished (done) | time=25ms
INFO: Analysis report generated in 95ms, dir size=113 KB
INFO: Analysis report compressed in 121ms, zip size=34 KB
INFO: Analysis report uploaded in 55ms
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at --- URL
INFO: Analysis total time: 25.711 s
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 27.058s
INFO: Final Memory: 11M/47M
INFO: ------------------------------------------------------------------------

Here is showing 0% coverage.

I dont have lcov files generated, do we really need it? but we have cobertura reports available

I am using type script 3.9.7 so accordingly upgraded sonarqube to 8.7 in order to support TS version
Below is my sonar file:

# Sonar Host URL http://sonar_url

# Project identification

# Provide analysis parameters according to your requirements

It working after adding lcov reports to package.json and its path to sonar.perperties file.

1 Like

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