How to get code coverage in SonarQube report Node.js+SonarQube+Azure DevOps SQ widgets

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

SonarQube 7.1 Community Edition (running in docker in Azure Web App Linux for containers), In my Azure Build Pipeline I’m using following extension (, Node.js.

  • what are you trying to achieve

I want to have code coverage non zero (0) in my SonarQube report and also if it possible I want to have content of junit.xml test result file which generated by jest-junit in my SQ report. In my build pipeline in Azure Devops I’m using cobertura-coverage.xml and junit.xml without any issue both reports works fine.

  • what have you tried so far to achieve this

Honestly I think I tried everything. I spent almost three days without any success.

In run code analysis task I’m using file.I tried following and some other parametes combinations of parameters (none of this parameters didnt help me):

In my package.json I have following part:
“scripts”: {
“testci”: “react-scripts test --ci --reporters=jest-junit --reporters=default --coverage --coverageReporters=cobertura --coverageReporters=lcov --coverageReporters=html --transformIgnorePatterns “node_modules/(?!@amcharts)/””,

I executing “npm run testci” as part of my pipeline and got following bunch of reports:
and also client/junit.xml.

Could you please help me to figure out how to get code coverage and test results in SonarQube report.

What happens if you pass the coverage/ file to sonar.javascript.lcov.reportPaths? Is there anything in your analysis logs about the parsing of coverage reports?

Hello Colin!

Here is my file:


sonar.exclusions=client/node_modules/*,client/Docker*,client/,client/**/*.test.*,client /coverage/,client/coverage/lcov-report/*




I checked all logs in build agents and there is nothing regarding sonar.javascript.lcov.reportPaths or client/coverage/ or both.

Also I checked all logs on server access.log, es.log,sonar.log,web.log. Only in access.log I found one single mention: - - [14/Aug/2019:21:57:14 +0000] "GET /api/settings/values?keys=sonar.javascript.file.suffixes%2Csonar.javascript.globals%2Csonar.javascript.ignoreHeaderComments%2Csonar.javascript.exclusions%2C

The only one setting which was not ignored according logs was sonar.coverageReportPaths but all reports which I set as value was in wrong XML format (according logs)

Any ideas?

Could you still share the logs?
Are JS files analyzed at all? Do you see them with syntax highlighting in SQ UI?

Hi Elena,

13.txt (8.2 KB)

I deleted some sensitive info from log. Both cobertura-coverage.xml files exists.


# =====================================================
#   Definition of the modules
# =====================================================



# =====================================================
#   Frontend
# =====================================================



# =====================================================
#   Backend
# =====================================================




# =====================================================
#   Reports
# =====================================================


Why do you think you SonarQube should read Cobertura report? Did you install the community plugin?

Also from the logs I see that there is no a single JS file in your project, only TS. For TS to import coverage natively (without any additional plugins) you should generate coverage report in LCOV format and use property sonar.typescript.lcov.reportPaths


Hello Elena,

typescript.lcov.reportPaths=coverage/ is working!! Thank you for advice!!

@Lena Been trying to solve the same problem all day, and finally found the solution in your comment.

Can you or someone else from your team please update the Test Coverage & Execution doc for both SonarQube (link) and SonarSource (link) to include sonar.typescript.lcov.reportPaths for TypeScript? It currently lists sonar.javascript.lcov.reportPaths for both JS and TS files, which is highly misleading, and is what I had been using and wondering wth is going on.

Thank you!

Update: Nevermind. Got a warning: WARN: The use of sonar.typescript.lcov.reportPaths for coverage import is deprecated, use sonar.javascript.lcov.reportPaths instead.. Will create a new ticket to figure out why the coverage info is not being reported.

I am trying to get the test execution report on sonarqube the coverage is successfull but not the unit test.
My sonarqube is running inside docker container. I have generated the test execution data using “mocha-sonarqube-reporter” and recived the data in xml format.
used nyc for coverage report.
the sonarqube cmd is as follows:

The sonar logs are as follows:
INFO: Scanner configuration file: /var/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/extensure-sonar-scanner/conf/
INFO: Project root configuration file: NONE
INFO: SonarScanner
INFO: Java 1.8.0_272 AdoptOpenJDK (64-bit)
INFO: Linux 4.19.76-linuxkit amd64
INFO: User cache: /root/.sonar/cache
INFO: Scanner configuration file: /var/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/extensure-sonar-scanner/conf/
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 8.4.1
INFO: Default locale: “en_US”, source code encoding: “UTF-8” (analysis is platform dependent)
WARN: SonarScanner will require Java 11 to run starting in SonarQube 8.x
INFO: Load global settings
INFO: Load global settings (done) | time=64ms
INFO: Server id: BF41A1F2-AXZHlvEOpdl3jkIdcHbq
INFO: User cache: /root/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=35ms
INFO: Load/download plugins (done) | time=62ms
INFO: Process project properties
INFO: Process project properties (done) | time=7ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=3ms
INFO: Project key: Sonar_Extensure_test_11
INFO: Base dir: /var/jenkins_home/workspace/sonar_result_test
INFO: Working dir: /var/jenkins_home/workspace/sonar_result_test/.scannerwork
INFO: Load project settings for component key: ‘Sonar_Extensure_test_11’
INFO: Load project settings for component key: ‘Sonar_Extensure_test_11’ (done) | time=19ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=52ms
INFO: Auto-configuring with CI ‘Jenkins’
INFO: Load active rules
INFO: Load active rules (done) | time=985ms
INFO: Indexing files…
INFO: Project configuration:
INFO: 41 files indexed
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for ts: Sonar way
INFO: ------------- Run sensors on module Sonar_Extensure_test_11
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=21ms
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor SonarCSS 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=3ms
INFO: Sensor SonarJS Coverage [javascript]
INFO: Analysing [/var/jenkins_home/workspace/sonar_result_test/./coverage/]
INFO: Load project repositories
INFO: Load project repositories (done) | time=18ms
WARN: Could not resolve 3 file paths in [/var/jenkins_home/workspace/sonar_result_test/./coverage/]
WARN: First unresolved path: coverage/lcov-report/block-navigation.js (Run in DEBUG mode to get full list of unresolved paths)
INFO: Sensor SonarJS Coverage [javascript] (done) | time=76ms
INFO: Sensor TypeScript analysis [javascript]
INFO: Using TypeScript at: ‘/var/jenkins_home/workspace/sonar_result_test/node_modules’
INFO: Found 1 tsconfig.json file(s): [/var/jenkins_home/workspace/sonar_result_test/tsconfig.json]
INFO: 40 source files to be analyzed
INFO: Analyzing 40 files using tsconfig: /var/jenkins_home/workspace/sonar_result_test/tsconfig.json
WARN: You are using version of TypeScript 3.9.9 which is not officially supported; supported versions >=3.2.1 <3.8.0
INFO: 40/40 source files have been analyzed
INFO: Sensor TypeScript analysis [javascript] (done) | time=5156ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=1ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=2ms
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 Generic Test Executions Report
INFO: Parsing /var/jenkins_home/workspace/sonar_result_test/xunit.xml
INFO: Imported test execution data for 0 files
INFO: Test execution data ignored for 9 unknown files, including:
INFO: Sensor Generic Test Executions Report (done) | time=43ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=4ms
INFO: CPD Executor 3 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 37 files
INFO: CPD Executor CPD calculation finished (done) | time=32ms
INFO: Analysis report generated in 62ms, dir size=286 KB
INFO: Analysis report compressed in 88ms, zip size=131 KB
INFO: Analysis report uploaded in 22ms
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
INFO: Analysis total time: 8.455 s
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 9.134s
INFO: Final Memory: 17M/253M
INFO: ------------------------------------------------------------------------

Not able to understand why this is happening:
INFO: Test execution data ignored for 9 unknown files, including:

The coverage is visible but the unit test are not…

How do i get the unit test result on sonarqube
Please let me know what is missing here