Skip to content
This repository has been archived by the owner on Jul 8, 2019. It is now read-only.

SonarTsPlugin not attempting to load LCOV coverage file #177

Open
ChrisBellew opened this issue Sep 26, 2017 · 4 comments
Open

SonarTsPlugin not attempting to load LCOV coverage file #177

ChrisBellew opened this issue Sep 26, 2017 · 4 comments

Comments

@ChrisBellew
Copy link

ChrisBellew commented Sep 26, 2017

Hello,

Firstly, thanks for the great plugin. It's really useful, just have one small problem to do with code coverage. I'm using SonarQube Scanner 3.0.3.778, SonarTS 1.0.0.340 and SonarQube server 6.5.0.

I can't seem to get the plugin to load my lcov.info coverage file that my unit test pipeline (Karma -> remap-istanbul) has output. I have tried setting sonar.ts.coverage.lcovReportPath=lcov.info but it doesn't appear to be using it. I have the following two reasons to believe this:

  1. The logs from sonar-scanner -X show the step taking 0ms, which seems suspiciously fast to load and parse a file.
13:21:56.580 INFO: Sensor TypeScript LCOV Coverage Sensor [typescript]
13:21:56.580 INFO: Sensor TypeScript LCOV Coverage Sensor [typescript] (done) | time=0ms
  1. I have opened Process Monitor (im on windows) and inspected the file system requests the process is making. With the above sonar.ts.coverage.lcovReportPath=lcov.info I see no hits to the file system. I ran another test with the following config...
sonar.ts.lcov.reportpath=lcov.info1
sonar.ts.coverage.lcovReportPath=lcov.info2
sonar.javascript.lcov.reportPath=lcov.info3
sonar.javascript.lcov.reportPaths=lcov.info4

...because I wanted to see (a) if my process monitor filter ('lcov') was working, and (b) to see if any of the others settings would work instead. Process Monitor successfully recorded a file system hit for the lcov.info4 file, which means sonar.javascript.lcov.reportPaths=lcov.info4 was getting picked up, but coverage is still at 0%. So I know my settings file is working, and I know TsPlugin didn't attempt to hit the file system.

I don't have any errors in the logs. There's a bunch of warnings but TBH they look unrelated. The analysis is otherwise getting reported and working well in SonarQube.

If you have any ideas that would be much appreciated. Thanks in advance! Chris

@nixel2007
Copy link

Are you sure that you have installed TypeScript plugin from Pablissimo and not from SonarSource?

@resah
Copy link

resah commented Nov 6, 2017

I have the same issue using the extension sonar-typescript-plugin-1.1.0.1043.jar

sonar.projectKey=project:start
sonar.projectName=StartProject
sonar.projectVersion=1.0
sonar.sources=.
sonar.exclusions=node_modules/**
sonar.sourceEncoding=UTF-8
sonar.modules=client,server

client.sonar.projectName=client
client.sonar.sources=src
client.sonar.exclusions=**/node_modules/**
client.sonar.tests=src/app
client.sonar.test.inclusions=**/*.spec.ts
client.sonar.ts.tslint.configPath=tslint.json
client.sonar.ts.coverage.lcovReportPath=coverage/lcov.info

server.sonar.projectName=server
server.sonar.sources=src/main/groovy
server.sonar.tests=src/test/groovy

Unfortunely the lcov.info is never picked up. I tried a different approach with a single module setup, but the outcome was the same.

@lillicrm
Copy link

Worked for me to use this property to define paths
sonar.typescript.lcov.reportPaths=coverage/lcov.info

as documented here..
https://docs.sonarqube.org/display/PLUG/TypeScript+Coverage+Results+Import

@resah
Copy link

resah commented Nov 16, 2017

Thanks @lillicrm ,

this helped!

Unfortunately this property is called differently on https://github.com/Pablissimo/SonarTsPlugin , which caused the problems and confusion. I guess the readme file should be updated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants