title: JS CodeCoverage analysis with Sonar
body: <p>I have a JavaScript project, which I am analysing with Sonar. Everything works fine, except the code coverage analysis.</p>
  
  <p>I am using Karma to create the line coverage <code>lcov.info</code> file.</p>
  
  <p>When I do the analysis from my cmd / cywin, with:</p>
  
  <pre><code>mvn sonar:sonar -Pci-sonar-js
  </code></pre>
  
  <p>Everything works fine and Sonar displays the code coverage, when I do the same from my Jenkins Job. The Code Coverage is displayed with 0%!</p>
  
  <p>Sonar parses the lcov.info file, and there is no differences in the output of the analysis, except for the parsing duration of the file (cmd~60ms, jenkins~30ms).</p>
  
  <p><strong>Sonar part of pom.xml</strong></p>
  
  <pre><code>&lt;profile&gt;
      &lt;id&gt;ci-sonar-js&lt;/id&gt;
  
      &lt;properties&gt;
          &lt;sonar.branch&gt;JavaScript&lt;/sonar.branch&gt;
          &lt;sonar.language&gt;js&lt;/sonar.language&gt;
          &lt;sonar.exclusions&gt;src/test/webapp/lib/**,**/datepick.min.js,**/fileupload.js,**/fileupload.min.js,**/moment.js,**/moment.min.js,**/script.min.js,**/syntaxhighlighter.js,**/syntaxhighlighter.min.js&lt;/sonar.exclusions&gt;
          &lt;sonar.dynamicAnalysis&gt;reuseReports&lt;/sonar.dynamicAnalysis&gt;
          &lt;sonar.sourceEncoding&gt;UTF-8&lt;/sonar.sourceEncoding&gt;
  
          &lt;sonar.javascript.jstest.reportsPath&gt;target/surefire-reports/&lt;/sonar.javascript.jstest.reportsPath&gt;
          &lt;sonar.javascript.lcov.reportPath&gt;target/lcov.info&lt;/sonar.javascript.lcov.reportPath&gt;
  
          &lt;ci.build.sourceDirectory&gt;${basedir}/target/classes/META-INF/public/js/min/&lt;/ci.build.sourceDirectory&gt;
          &lt;ci.build.testSourceDirectory&gt;${basedir}/src/test/webapp/&lt;/ci.build.testSourceDirectory&gt;
      &lt;/properties&gt;
  
      &lt;build&gt;
          ...
      &lt;/build&gt;
  &lt;/profile&gt;
  </code></pre>
  
  <p><strong>Jenkins Log:</strong></p>
  
  <pre><code>[Sonar JavaScript] $ C:\tools\apache-maven-3.0.5\bin\mvn.bat -f "c:\workspace\Sonar JavaScript\pom.xml" -e -B sonar:sonar -Pci-sonar-js -Dsonar.jdbc.driver=oracle.jdbc.OracleDriver -Dsonar.jdbc.url=jdbc:oracle:thin:@&lt;my_shortened_db_connection&gt; ******** ******** -Dsonar.host.url=http://&lt;my_shortened_hostname&gt;:9000 -Dsonar.branch=JavaScript -Dsonar.language=js
  [INFO] Error stacktraces are turned on.
  [INFO] Scanning for projects...
  [INFO]                                                                         
  [INFO] ------------------------------------------------------------------------
  [INFO] Building myProject 1.0.0.05-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO] 
  [INFO] --- sonar-maven-plugin:2.1:sonar (default-cli) @ myProject ---
  [INFO] SonarQube version: 3.6.2
  [INFO] [16:51:59.960] Load batch settings
  [INFO] [16:52:00.007] User cache: C:\Dokumente und Einstellungen\&lt;my_shortened_user&gt;\.sonar\cache
  [INFO] [16:52:00.069] Install plugins
  [INFO] [16:52:00.726] Install JDBC driver
  [INFO] [16:52:00.741] Create JDBC datasource for jdbc:oracle:thin:@&lt;my_shortened_db_connection&gt;
  [INFO] [16:52:02.163] Initializing Hibernate
  [INFO] [16:52:08.898] Load project settings
  [INFO] [16:52:08.913] Apply project exclusions
  [INFO] [16:52:09.023] -------------  Scan myProject JavaScript
  [INFO] [16:52:09.023] Load module settings
  [INFO] [16:52:09.288] Quality profile : [name=Sonar way,language=js]
  [INFO] [16:52:09.304] Excluded sources: 
  [INFO] [16:52:09.304]   src/test/webapp/lib/**
  [INFO] [16:52:09.304]   **/datepick.min.js
  [INFO] [16:52:09.304]   **/fileupload.js
  [INFO] [16:52:09.304]   **/fileupload.min.js
  [INFO] [16:52:09.304]   **/moment.js
  [INFO] [16:52:09.304]   **/moment.min.js
  [INFO] [16:52:09.304]   **/script.min.js
  [INFO] [16:52:09.304]   **/syntaxhighlighter.js
  [INFO] [16:52:09.304]   **/syntaxhighlighter.min.js
  [INFO] [16:52:09.304] Excluded tests: 
  [INFO] [16:52:09.304]   **/package-info.java
  [INFO] [16:52:09.335] Configure Maven plugins
  [INFO] [16:52:09.367] Compare to previous analysis (2013-09-23)
  [INFO] [16:52:09.382] Compare over 5 days (2013-09-18, analysis of 2013-09-23 14:22:37.579)
  [INFO] [16:52:09.382] Compare over 30 days (2013-08-24, analysis of 2013-09-23 14:22:37.579)
  [INFO] [16:52:09.679] Base dir: c:\workspace\Sonar JavaScript
  [INFO] [16:52:09.679] Working dir: c:\workspace\Sonar JavaScript\target\sonar
  [INFO] [16:52:09.679] Source dirs: c:\workspace\Sonar JavaScript\target\classes\META-INF\public\js\min
  [INFO] [16:52:09.679] Test dirs: c:\workspace\Sonar JavaScript\src\test\webapp
  [INFO] [16:52:09.679] Binary dirs: c:\workspace\Sonar JavaScript\target\classes
  [INFO] [16:52:09.679] Source encoding: UTF-8, default locale: de_DE
  [INFO] [16:52:09.710] Sensor JavaScriptSourceImporter...
  [INFO] [16:52:09.804] Sensor JavaScriptSourceImporter done: 94 ms
  [INFO] [16:52:09.804] Sensor JavaScriptSquidSensor...
  [INFO] [16:52:11.101] Sensor JavaScriptSquidSensor done: 1297 ms
  [INFO] [16:52:11.101] Sensor LCOVSensor...
  [INFO] [16:52:11.101] Analysing C:\workspace\Sonar JavaScript\target\lcov.info
  [INFO] [16:52:11.132] Sensor LCOVSensor done: 31 ms
  [INFO] [16:52:11.132] Sensor JsTestSensor...
  [INFO] [16:52:14.382] Sensor JsTestSensor done: 3250 ms
  [INFO] [16:52:14.382] Sensor CpdSensor...
  [INFO] [16:52:14.382] SonarBridgeEngine is used
  [INFO] [16:52:14.382] Cross-project analysis disabled
  [INFO] [16:52:14.601] Sensor CpdSensor done: 219 ms
  [INFO] [16:52:14.601] Sensor InitialOpenIssuesSensor...
  [INFO] [16:52:14.601] Sensor InitialOpenIssuesSensor done: 0 ms
  [INFO] [16:52:14.601] Sensor ProfileSensor...
  [INFO] [16:52:14.617] Sensor ProfileSensor done: 16 ms
  [INFO] [16:52:14.617] Sensor ProfileEventsSensor...
  [INFO] [16:52:14.632] Sensor ProfileEventsSensor done: 15 ms
  [INFO] [16:52:14.632] Sensor ProjectLinksSensor...
  [INFO] [16:52:14.648] Sensor ProjectLinksSensor done: 16 ms
  [INFO] [16:52:14.648] Sensor VersionEventsSensor...
  [INFO] [16:52:14.664] Sensor VersionEventsSensor done: 16 ms
  [INFO] [16:52:14.664] Sensor Maven dependencies...
  [INFO] [16:52:15.570] Sensor Maven dependencies done: 906 ms
  [INFO] [16:52:15.882] Execute decorators...
  [INFO] [16:52:19.476] Store results in database
  [INFO] [16:52:19.570] ANALYSIS SUCCESSFUL, you can browse http://&lt;my_shortened_hostname&gt;:9000/dashboard/index/com.mycompany:myProject:JavaScript
  [INFO] [16:52:19.570] Executing post-job class org.sonar.plugins.doxygen.DoxygenPostJob
  [ERROR] [16:52:19.570] The global property 'sonar.doxygen.deploymentPath' is not set. Set it in SONAR and run another analysis.
  [INFO] [16:52:19.570] Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob
  [INFO] [16:52:19.570] Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
  [INFO] [16:52:19.648] Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
  [INFO] [16:52:19.664] -&gt; Keep one snapshot per day between 2013-08-26 and 2013-09-22
  [INFO] [16:52:19.664] -&gt; Keep one snapshot per week between 2012-09-24 and 2013-08-26
  [INFO] [16:52:19.664] -&gt; Keep one snapshot per month between 2008-09-29 and 2012-09-24
  [INFO] [16:52:19.664] -&gt; Delete data prior to: 2008-09-29
  [INFO] [16:52:19.664] -&gt; Clean myProject JavaScript [id=14180]
  [INFO] [16:52:19.679] &lt;- Clean snapshot 118948
  [INFO] [16:52:19.976] Executing post-job class org.sonar.plugins.buildbreaker.AlertBreaker
  [INFO] [16:52:19.976] Executing post-job class org.sonar.plugins.buildbreaker.ForbiddenConfigurationBreaker
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 22.251s
  [INFO] Finished at: Mon Sep 23 16:52:20 CEST 2013
  [INFO] Final Memory: 22M/172M
  [INFO] ------------------------------------------------------------------------
  Sonar analysis completed: SUCCESS
  Zeichne Testergebnisse auf.
  Finished: SUCCESS
  </code></pre>