Unable to import JS code coverage and test results in SonarQube

Must-share information:

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

  • what are you trying to achieve
    I am trying to display the code coverage result of js source on sonar server through VSTS/TFS builds. In TFS build summary, I can see the Test results and Code coverage results but on Sonar server its 0.

I tried to add below property under Additional properties of TFS build task for sonar

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

2018-07-25T12:19:30.8081414Z ##[section]Starting: Run Code Analysis
2018-07-25T12:19:30.8081414Z ==============================================================================
2018-07-25T12:19:30.8081414Z Task         : Run Code Analysis
2018-07-25T12:19:30.8081414Z Description  : Run scanner and upload the results to the SonarQube server.
2018-07-25T12:19:30.8081414Z Version      : 4.3.0
2018-07-25T12:19:30.8081414Z Author       : sonarsource
2018-07-25T12:19:30.8081414Z Help         : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

More Information

2018-07-25T12:19:30.8081414Z ==============================================================================
2018-07-25T12:19:31.1987724Z [command]C:\Windows\system32\cmd.exe /D /S /C "F:\Builds\PoC\_tasks\SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055\4.3.0\sonar-scanner\bin\sonar-scanner.bat"
2018-07-25T12:19:31.4487765Z INFO: Scanner configuration file: F:\Builds\PoC\_tasks\SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055\4.3.0\sonar-scanner\bin\..\conf\sonar-scanner.properties
2018-07-25T12:19:31.4487765Z INFO: Project root configuration file: NONE
2018-07-25T12:19:31.4800276Z INFO: SonarQube Scanner 3.2.0.1227
2018-07-25T12:19:31.4800276Z INFO: Java 1.8.0_172 Oracle Corporation (64-bit)
2018-07-25T12:19:31.4800276Z INFO: Windows Server 2016 10.0 amd64
2018-07-25T12:19:31.8394051Z INFO: User cache: C:\Users\svc_TFSservice\.sonar\cache
2018-07-25T12:19:32.0112885Z INFO: SonarQube server 6.7.4
2018-07-25T12:19:32.0112885Z INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
2018-07-25T12:19:32.2456844Z INFO: Publish mode
2018-07-25T12:19:32.4175377Z INFO: Load global settings
2018-07-25T12:19:32.4800376Z INFO: Load global settings (done) | time=63ms
2018-07-25T12:19:32.4956827Z INFO: Server id: AWSINHFcyfTZeEnNftFR
2018-07-25T12:19:32.5112897Z INFO: User cache: C:\Users\svc_TFSservice\.sonar\cache
2018-07-25T12:19:32.7769247Z INFO: Load plugins index
2018-07-25T12:19:32.8706860Z INFO: Load plugins index (done) | time=94ms
2018-07-25T12:19:33.6363048Z INFO: Process project properties
2018-07-25T12:19:33.6675550Z INFO: Load project repositories
2018-07-25T12:19:33.7925536Z INFO: Load project repositories (done) | time=125ms
2018-07-25T12:19:33.8867090Z INFO: Load quality profiles
2018-07-25T12:19:34.0738078Z INFO: Load quality profiles (done) | time=187ms
2018-07-25T12:19:34.0894354Z INFO: Load active rules
2018-07-25T12:19:35.1757370Z INFO: Load active rules (done) | time=1086ms
2018-07-25T12:19:35.1913329Z INFO: Load metrics repository
2018-07-25T12:19:35.2225850Z INFO: Load metrics repository (done) | time=31ms
2018-07-25T12:19:35.2851720Z ##[error]WARN: SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
2018-07-25T12:19:35.2851720Z WARN: SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
2018-07-25T12:19:35.2851720Z INFO: Project key: TFS
2018-07-25T12:19:35.2851720Z INFO: -------------  Scan HTML5PoC
2018-07-25T12:19:35.4569615Z INFO: Load server rules
2018-07-25T12:19:35.6132131Z INFO: Load server rules (done) | time=141ms
2018-07-25T12:19:35.6444634Z INFO: Base dir: F:\Builds\PoC\13\s
2018-07-25T12:19:35.6607250Z INFO: Working dir: F:\Builds\PoC\13\s\.scannerwork
2018-07-25T12:19:35.6607250Z INFO: Source paths: .
2018-07-25T12:19:35.6607250Z INFO: Source encoding: windows-1252, default locale: en_US
2018-07-25T12:19:35.8163433Z INFO: Index files
2018-07-25T12:19:35.8163433Z INFO: Excluded sources: 
2018-07-25T12:19:35.8163433Z INFO:   node_modules/**
2018-07-25T12:19:45.8320973Z INFO: 211 files indexed...  (last one was coverage/src/app/shared/models/request-Item-page.ts.html)
2018-07-25T12:19:49.0040095Z INFO: 344 files indexed
2018-07-25T12:19:49.0040095Z INFO: 34958 files ignored because of inclusion/exclusion patterns
2018-07-25T12:19:49.0040095Z INFO: Quality profile for cs: Sonar way
2018-07-25T12:19:49.0040095Z INFO: Quality profile for js: Sonar way
2018-07-25T12:19:49.0040095Z INFO: Quality profile for ts: Sonar way
2018-07-25T12:19:49.0040095Z INFO: Quality profile for xml: Sonar way
2018-07-25T12:19:50.0665282Z INFO: Sensor C# [csharp]
2018-07-25T12:19:50.0665282Z INFO: Importing analysis results from F:\Builds\PoC\13\s\null\output-cs
2018-07-25T12:19:50.0821498Z ##[error]WARN: Protobuf file not found: null\output-cs\encoding.pb
2018-07-25T12:19:50.0821498Z WARN: Protobuf file not found: null\output-cs\encoding.pb
2018-07-25T12:19:50.0977743Z ##[error]WARN: Protobuf file not found: null\output-cs\metrics.pb
2018-07-25T12:19:50.0977743Z WARN: Protobuf file not found: null\output-cs\metrics.pb
2018-07-25T12:19:50.0977743Z ##[error]WARN: Protobuf file not found: null\output-cs\issues.pb
2018-07-25T12:19:50.0977743Z WARN: Protobuf file not found: null\output-cs\issues.pb
2018-07-25T12:19:50.0977743Z ##[error]WARN: Protobuf file not found: null\output-cs\token-type.pb
2018-07-25T12:19:50.0977743Z WARN: Protobuf file not found: null\output-cs\token-type.pb
2018-07-25T12:19:50.0977743Z ##[error]WARN: Protobuf file not found: null\output-cs\symrefs.pb
2018-07-25T12:19:50.0977743Z 
2018-07-25T12:19:50.0977743Z ##[error]WARN: Protobuf file not found: null\output-cs\token-cpd.pb
2018-07-25T12:19:50.0977743Z WARN: Protobuf file not found: null\output-cs\token-cpd.pb
2018-07-25T12:19:50.0977743Z INFO: Sensor C# [csharp] (done) | time=31ms
2018-07-25T12:19:50.0977743Z INFO: Sensor SonarJavaXmlFileSensor [java]
2018-07-25T12:19:50.1299140Z INFO: 2 source files to be analyzed
2018-07-25T12:19:50.3013418Z INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=188ms
2018-07-25T12:19:50.3013418Z INFO: Sensor XML Sensor [xml]
2018-07-25T12:19:50.3013418Z INFO: 2/2 source files have been analyzed
2018-07-25T12:19:50.8321615Z INFO: Sensor XML Sensor [xml] (done) | time=547ms
2018-07-25T12:19:50.8321615Z INFO: Sensor Analyzer for "php.ini" files [php]
2018-07-25T12:19:50.8477834Z INFO: Sensor Analyzer for "php.ini" files [php] (done) | time=15ms
2018-07-25T12:19:50.8477834Z INFO: Sensor TypeScript Sensor [typescript]
2018-07-25T12:19:59.9729046Z INFO: Sensor TypeScript Sensor [typescript] (done) | time=9125ms
2018-07-25T12:19:59.9885275Z INFO: Sensor TypeScript LCOV Coverage Sensor [typescript]
2018-07-25T12:19:59.9885275Z INFO: Sensor TypeScript LCOV Coverage Sensor [typescript] (done) | time=0ms
2018-07-25T12:19:59.9885275Z INFO: Sensor JavaScript Squid Sensor [javascript]
2018-07-25T12:19:59.9885275Z INFO: 5 source files to be analyzed
2018-07-25T12:20:00.6135396Z INFO: Test Coverage Sensor is started
2018-07-25T12:20:00.6135396Z INFO: Analysing [F:\Builds\PoC\13\s\coverage\lcov.info]
2018-07-25T12:20:00.6135396Z INFO: 5/5 source files have been analyzed
2018-07-25T12:20:00.6291646Z INFO: Sensor JavaScript Squid Sensor [javascript] (done) | time=657ms
2018-07-25T12:20:00.6291646Z INFO: Sensor C# Tests Coverage Report Import [csharp]
2018-07-25T12:20:00.6291646Z INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=0ms
2018-07-25T12:20:00.6291646Z INFO: Sensor [Deprecated] C# Integration Tests Coverage Report Import [csharp]
2018-07-25T12:20:00.6291646Z INFO: Sensor [Deprecated] C# Integration Tests Coverage Report Import [csharp] (done) | time=0ms
2018-07-25T12:20:00.6291646Z INFO: Sensor C# Unit Test Results Import [csharp]
2018-07-25T12:20:00.6291646Z INFO: Sensor C# Unit Test Results Import [csharp] (done) | time=0ms
2018-07-25T12:20:00.6291646Z INFO: Sensor Zero Coverage Sensor
2018-07-25T12:20:00.7541667Z INFO: Sensor Zero Coverage Sensor (done) | time=109ms
2018-07-25T12:20:00.7541667Z INFO: Sensor CPD Block Indexer
2018-07-25T12:20:00.7541667Z INFO: Sensor CPD Block Indexer (done) | time=0ms
2018-07-25T12:20:00.7541667Z INFO: No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
2018-07-25T12:20:00.7541667Z INFO: 8 files had no CPD blocks
2018-07-25T12:20:00.7541667Z INFO: Calculating CPD for 66 files
2018-07-25T12:20:00.8479200Z INFO: CPD calculation finished
2018-07-25T12:20:01.5041825Z INFO: Analysis report generated in 641ms, dir size=582 KB
2018-07-25T12:20:01.7854381Z INFO: Analysis reports compressed in 281ms, zip size=232 KB
2018-07-25T12:20:02.1604516Z INFO: Analysis report uploaded in 375ms
2018-07-25T12:20:02.1604516Z INFO: ANALYSIS SUCCESSFUL, you can browse http://vwmazimdvpt1:9000/dashboard/index/TFS
2018-07-25T12:20:02.1604516Z INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
2018-07-25T12:20:02.1604516Z INFO: More about the report processing at http://vwmazimdvpt1:9000/api/ce/task?id=AWTRYcDIWZanet4pC3CC
2018-07-25T12:20:02.3635718Z INFO: Task total time: 29.383 s
2018-07-25T12:20:02.4104493Z INFO: ------------------------------------------------------------------------
2018-07-25T12:20:02.4104493Z INFO: EXECUTION SUCCESS
2018-07-25T12:20:02.4104493Z INFO: ------------------------------------------------------------------------
2018-07-25T12:20:02.4104493Z INFO: Total time: 30.977s
2018-07-25T12:20:02.5354523Z INFO: Final Memory: 21M/478M
2018-07-25T12:20:02.5354523Z INFO: ------------------------------------------------------------------------
2018-07-25T12:20:02.6292065Z ##[section]Finishing: Run Code Analysis

Hi @pratik.tayde,

Have you specified the specific arguments for the JS coverage as describe here?

Cheers,
Amaury