0

I am using SonarQube for a Javascript project. In dashboard I see Unit test success 100.0%, but I don't see a value for Unit Test Coverage.

I am creating a LCOV file using JSCover, and passing it to Sonar in the sonar-project.properties file:

sonar.javascript.lcov.reportPath=app-test/target/phantom/jscover.lcov

It seems to me that sonar runner is reading the correct file during the execution:

...
10:17:47.111 INFO  - Sensor LCOVSensor...
10:17:47.112 INFO  - Analysing C:\Users\Ubi60\.jenkins\jobs\T2Client\workspace\app-test\target\phantom\jscover.lcov
10:17:47.131 INFO  - Sensor LCOVSensor done: 20 ms
...

Here are a few lines from my jscover.lcov file:

SF:C:/Users/Ubi60/.jenkins/jobs/T2Client/workspace/app-test/target/phantom/Dashboard/app/store/DeviceDataStore.js
FNF:0
FNH:0
DA:4,1
DA:10,14
DA:12,14
DA:13,1
end_of_record
SF:C:/Users/Ubi60/.jenkins/jobs/T2Client/workspace/app-test/target/phantom/Dashboard/app/store/FollowUnitStore.js
FNF:0
FNH:0
DA:4,1
DA:10,14
DA:12,14
DA:13,1
end_of_record
...

I already tried to revert the slashes in paths, but with no luck.

Any suggestion?

quamat
  • 1
  • 1
  • Do you run the SonarQube analysis at the same location where JSCover was executed? What typically happens is that the unit tests are run in folder "Foo" whereas SonarQube analysis is run in folder "Bar": from there, SonarQube can't understand the absolute paths that used to reference the JS files in the LCOV report. – Fabrice - SonarSource Team Sep 16 '13 at 07:35
  • I run SonarQube from a different location, so I tried to manually change the absolute paths in the LCOV report, but the outcome is the same - nothing. Where can I find in Sonar the correct paths I should use in LCOV report? – quamat Sep 25 '13 at 13:31
  • In your example, you should trigger the SonarQube analysis in the "C:/Users/Ubi60/.jenkins/jobs/T2Client/workspace/app-test" folder. – Fabrice - SonarSource Team Sep 25 '13 at 13:40

1 Answers1

0

The setting name seems to be sonar.javascript.lcov.reportPaths. I have:

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

And I get my coverage.

bernardn
  • 1,701
  • 5
  • 19
  • 23