Jenkins not able to analyse the javascript files / not able to generate coverage/lcov file

Need help on below issue
Sonar scanner giving a report as zero on everything when we try to run it from jenkins job ,below are the details

sonar.javascript.lcov.reportPaths=coverage/lcov.info added in sonar-project.properties file

console output

INFO: Indexing files...
INFO: Project configuration:
INFO:   Included sources: lib/rest/entitlement/*.js, lib/rest/entitlement/*.spec.js
INFO:   Excluded sources: /node_modules/**, /node_modules**, workers/site-info-sync/node_modules/*, app/**/**/**/**/*.css, lib/rest/entitlement/*.spec.js, lib/auth/iot-idm/*.spec.js
INFO:   Included tests: lib/rest/entitlement/*.spec.js, lib/auth/iot-idm/*.spec.js
INFO: Load project repositories
INFO: Load project repositories (done) | time=528ms
INFO: 17 files indexed
INFO: 47284 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for js: Sonar way Recommended
INFO: ------------- Run sensors on module Entitlement Service V1
INFO: JavaScript/TypeScript frontend is enabled
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=243ms
INFO: Sonargraph Integration: Created 55 predefined and 0 custom metric(s)
INFO: Sensor CSS Rules [cssfamily]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor CSS Rules [cssfamily] (done) | time=1ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=0ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=1ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=3ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=1ms
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=3ms
INFO: Sensor JavaScript analysis [javascript]
INFO: Deploying custom rules bundle jar:file:/home/jenkins/.sonar/cache/1c0d0d6d358b2ff25a27998c60079e2e/sonar-securityjsfrontend-plugin.jar!/js-vulnerabilities-rules-1.0.0.tgz to /var/lib/jenkins/node/workspace/Mobility/Service-Tag-Services-New/entitlement_v1_build_ecrimage_new2/service-cloud/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules3928428591943591486
ERROR: /var/lib/jenkins/node/workspace/Mobility/Service-Tag-Services-New/entitlement_v1_build_ecrimage_new2/service-cloud/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/eslint/lib/cli-engine/cli-engine.js:421
ERROR:     } catch {
ERROR:             ^
ERROR: 
ERROR: SyntaxError: Unexpected token {
ERROR:     at createScript (vm.js:74:10)
ERROR:     at Object.runInThisContext (vm.js:116:10)
ERROR:     at Module._compile (module.js:588:28)
ERROR:     at Object.Module._extensions..js (module.js:635:10)
ERROR:     at Module.load (module.js:545:32)
ERROR:     at tryModuleLoad (module.js:508:12)
ERROR:     at Function.Module._load (module.js:500:3)
ERROR:     at Module.require (module.js:568:17)
ERROR:     at require (internal/module.js:11:18)
ERROR:     at Object.<anonymous> (/var/lib/jenkins/node/workspace/Mobility/Service-Tag-Services-New/entitlement_v1_build_ecrimage_new2/service-cloud/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/eslint/lib/cli-engine/index.js:3:23)
ERROR: Failed to start server (300s timeout)
org.sonarsource.nodejs.NodeCommandException: Failed to start server (300s timeout)
	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServer(EslintBridgeServerImpl.java:125)
	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServerLazily(EslintBridgeServerImpl.java:191)
	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.startBridge(AbstractEslintSensor.java:150)
	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:124)
	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.execute(JavaScriptEslintBasedSensor.java:52)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:392)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:388)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:357)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:150)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)

INFO: Sensor JavaScript analysis [javascript] (done) | time=301941ms
INFO: Sensor TypeScript analysis [javascript]
INFO: No input files found for analysis
INFO: Sensor TypeScript analysis [javascript] (done) | time=1ms
INFO: Sensor JavaScript/TypeScript Coverage [javascript]
WARN: No coverage information will be saved because LCOV file cannot be found.
WARN: Provided LCOV file path: coverage/lcov.info. Seek file with path: /var/lib/jenkins/node/workspace/Mobility/Service-Tag-Services-New/entitlement_v1_build_ecrimage_new2/service-cloud/coverage/lcov.info
WARN: No coverage information will be saved because all LCOV files cannot be found.
INFO: Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=1ms
INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]
INFO: javasecurity:S5131 is not activated in quality profile: skipping execution of thymeleaf sensor.
INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=0ms
INFO: Sensor JavaSecuritySensor [security]
INFO: Reading type hierarchy from: /var/lib/jenkins/node/workspace/Mobility/Service-Tag-Services-New/entitlement_v1_build_ecrimage_new2/service-cloud/.scannerwork/ucfg2/java
INFO: Read 0 type definitions
INFO: Reading UCFGs from: /var/lib/jenkins/node/workspace/Mobility/Service-Tag-Services-New/entitlement_v1_build_ecrimage_new2/service-cloud/.scannerwork/ucfg2/java
INFO: No UCFGs have been included for analysis.

Hi,

Can you double-check the path where analysis is looking for the coverage report versus where the report actually is?

 
Ann

Hi Campbell,

Thanks for the response , Just wanted to check is this coverage report file will be generated dynamically when running the sonar scanner or it is the hardcoded thing.

Kindly help as i am new to this environment.

Regards,
Prajwal

Hi Prajwal,

Analysis does not generate your coverage report. You need to do that before you start analysis & feed the report in.

 
HTH,
Ann