Getting 0 % coverage on sonar dashboard

Sonar version: 8.9.10 LTS community edition, scanner: 4.8.0
I downloaded the sonarQube from internet as a zip file
I trying to get coverage report for my react project, but the coverage is coming up as 0 every time.

Here the logs:

INFO: Scanner configuration file: I:\ds\sonar-scanner-4.8.0.2856-windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: I:\overlimits\react-owl-ui\sonar-project.properties
INFO: SonarScanner 4.8.0.2856
INFO: Java 11.0.17 Eclipse Adoptium (64-bit)
INFO: Windows Server 2016 10.0 amd64
INFO: User cache: C:\Users\E918387\.sonar\cache
INFO: Analyzing on SonarQube server 8.9.10
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=203ms
INFO: Server id: BF41A1F2-AYY3OT9_Dp0PmyuXlZ2g
INFO: User cache: C:\Users\E918387\.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=163ms
INFO: Load/download plugins (done) | time=227ms
INFO: Process project properties
INFO: Process project properties (done) | time=10ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: react-owl-ui_2.0
INFO: Base dir: I:\overlimits\react-owl-ui
INFO: Working dir: I:\overlimits\react-owl-ui\.scannerwork
INFO: Load project settings for component key: 'react-owl-ui_2.0'
INFO: Load project settings for component key: 'react-owl-ui_2.0' (done) | time=138ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=158ms
INFO: Load active rules
INFO: Load active rules (done) | time=3016ms
INFO: Indexing files...
INFO: Project configuration:
INFO: Load project repositories
INFO: Load project repositories (done) | time=140ms
INFO: 7 files indexed...  (last one was nginx.conf)
INFO: 7 files indexed...  (last one was nginx.conf)
INFO: 7 files indexed...  (last one was nginx.conf)
INFO: 7 files indexed...  (last one was nginx.conf)
INFO: 7 files indexed...  (last one was nginx.conf)
INFO: 7 files indexed...  (last one was nginx.conf)
INFO: 112 files indexed
INFO: 61026 files ignored because of scm ignore settings
INFO: Quality profile for css: Sonar way
INFO: Quality profile for js: Sonar way
INFO: Quality profile for ts: Sonar way
INFO: Quality profile for web: Sonar way
INFO: Quality profile for xml: Sonar way
INFO: ------------- Run sensors on module react-owl-ui
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=146ms
INFO: Sensor CSS Metrics [cssfamily]
INFO: Sensor CSS Metrics [cssfamily] (done) | time=216ms
INFO: Sensor CSS Rules [cssfamily]
INFO: 19 source files to be analyzed
INFO: 19/19 source files have been analyzed
INFO: Sensor CSS Rules [cssfamily] (done) | time=17084ms
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=4ms
INFO: Sensor JavaScript analysis [javascript]
WARN: Node.js version 16 is not supported, you might experience issues. Please use a supported version of Node.js [10, 12, 14, 15]
INFO: 6 source files to be analyzed
ERROR: Browserslist: caniuse-lite is outdated. Please run:
ERROR: npx browserslist@latest --update-db
ERROR:
ERROR: Why you should do it regularly:
ERROR: https://github.com/browserslist/browserslist#browsers-data-updating
INFO: 6/6 source files have been analyzed
INFO: Sensor JavaScript analysis [javascript] (done) | time=35684ms
INFO: Sensor TypeScript analysis [javascript]
INFO: Found 1 tsconfig.json file(s): [I:\overlimits\react-owl-ui\tsconfig.json]
INFO: Analyzing 61 files using tsconfig: I:\overlimits\react-owl-ui\tsconfig.json
INFO: 64 source files to be analyzed
INFO: 54/64 files analyzed, current file: src/components/decisional-panel.store.tsx
INFO: Skipping 3 files with no tsconfig.json
INFO: 64/64 source files have been analyzed
INFO: Sensor TypeScript analysis [javascript] (done) | time=12483ms
INFO: Sensor JavaScript/TypeScript Coverage [javascript]
INFO: Analysing [I:\overlimits\react-owl-ui\coverage\lcov.info]
WARN: Could not resolve 47 file paths in [I:\overlimits\react-owl-ui\coverage\lcov.info]
WARN: First unresolved path: C:\JPMC\DEV\TMP\overlimits\react-owl-ui\src\components\AcknowledgeComponent.tsx (Run in DEBUG mode to get full list of unresolved paths)
INFO: Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=9ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=1ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=2ms
INFO: Sensor JavaXmlSensor [java]
INFO: 1 source file to be analyzed
INFO: 1/1 source file has been analyzed
INFO: Sensor JavaXmlSensor [java] (done) | time=138ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=56ms
INFO: Sensor XML Sensor [xml]
INFO: 1 source file to be analyzed
INFO: 1/1 source file has been analyzed
INFO: Sensor XML Sensor [xml] (done) | time=111ms
INFO: Sensor Project Type Information [vbnet]
INFO: Sensor  Project Type Information [vbnet] (done) | time=1ms
INFO: Sensor 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=188ms
INFO: SCM Publisher SCM provider for this project is: git
INFO: SCM Publisher 5 source files to be analyzed
INFO: SCM Publisher 0/5 source files have been analyzed (done) | time=250ms
WARN: Missing blame information for the following files:
WARN:   * test/CurrentLimitExposure.test.tsx
WARN:   * test/ElevatedApproval.test.tsx
WARN:   * test/AdditionalComments.test.tsx
WARN:   * jest.config.js
WARN:   * test-report.xml
WARN: This may lead to missing/broken features in SonarQube
INFO: CPD Executor 6 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 62 files
INFO: CPD Executor CPD calculation finished (done) | time=119ms
INFO: Analysis report generated in 456ms, dir size=430 KB
INFO: Analysis report compressed in 3008ms, zip size=226 KB
INFO: Analysis report uploaded in 159ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:7000/dashboard?id=react-owl-ui_2.0
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 http://localhost:7000/api/ce/task?id=AYaezDlQyut1KEo-amEn

here is the sonar properties:

sonar.projectKey=key

sonar.projectName=name

sonar.projectVersion=1.0

sonar.sources=src/

# sonar.tests=test/

sonar.language=ts

sonar.sourceEncoding=UTF-8

sonar.javascript.lcov.reportPaths=coverage/lcov.info

Help me resolve this issue.

Any help on this would largely appreciated

This issue is still open, let me if any additional info is required.

Hi,

Welcome to the community!

This looks like a problem of path mis-matches between your coverage report and the paths analysis is actually seeing.

A few things to check:

  • do the paths in your report actually exist on your build agent?
  • if the paths are relative, where do they start from? Inside your analysis directory, or somewhere above it?

:warning: Make sure you upgrade to SonarQube v9.9 LTS soon, not only to benefit from our Best LTS Ever™, but because soon we will systematically ask users to upgrade when they ask questions about earlier versions of SonarQube, which are now considered unsupported. :smiley:

 
Ann