New Project Scans always showing 0.0% test coverage

Hello everyone,

At my new organization all new projects are showing 0.0% code coverage.

All your projects are typescript with a mocha test suite, locally ìnstanbul/nyc` tool

  • We use Jenkins with the SonarCube Plugin
  • Its connected to our paid sonarcloud account with the provided key.
  • The cloud is using our license key (paid plan)
  • Alll sonarcube exections run with no errors:
2:15:46  + SONAR_SCANNER_OPTS=-Xmx1024m
12:15:46  + /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonar/bin/sonar-scanner -Dsonar.javascript.node.maxspace=4096 -Dsonar.verbose=false -Dsonar.log.level=INFO -Dsonar.branch.name=org-15988
12:15:46  INFO: Scanner configuration file: /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonar/conf/sonar-scanner.properties
12:15:46  INFO: Project root configuration file: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/sonar-project.properties
12:15:46  INFO: SonarQube Scanner 4.0.0.1744
12:15:46  INFO: Java 11.0.11 Red Hat, Inc. (64-bit)
12:15:46  INFO: Linux 3.10.0-1160.25.1.el7.x86_64 amd64
12:15:46  INFO: SONAR_SCANNER_OPTS=-Xmx1024m
12:15:46  INFO: User cache: /var/lib/jenkins/.sonar/cache
12:15:49  INFO: SonarQube server 9.0.1
12:15:49  INFO: Default locale: "en_US", source code encoding: "UTF-8"
12:15:49  INFO: Load global settings
12:15:50  INFO: Load global settings (done) | time=780ms
12:15:50  INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
12:15:50  INFO: User cache: /var/lib/jenkins/.sonar/cache
12:15:50  INFO: Load/download plugins
12:15:50  INFO: Load plugins index
12:15:50  INFO: Load plugins index (done) | time=220ms
12:16:22  INFO: Load/download plugins (done) | time=31557ms
12:16:22  INFO: Loaded core extensions: developer-scanner
12:16:22  INFO: Found an active CI vendor: 'Jenkins'
12:16:22  INFO: Load project settings for component key: 'myorg_org-user-view'
12:16:22  INFO: Load project settings for component key: 'myorg_org-user-view' (done) | time=228ms
12:16:22  INFO: Process project properties
12:16:22  INFO: Execute project builders
12:16:22  INFO: Execute project builders (done) | time=1ms
12:16:22  INFO: Project key: myorg_org-user-view
12:16:22  INFO: Base dir: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes
12:16:22  INFO: Working dir: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/.scannerwork
12:16:23  INFO: Load project branches
12:16:23  INFO: Load project branches (done) | time=264ms
12:16:23  INFO: Check ALM binding of project 'myorg_org-user-view'
12:16:23  INFO: Detected project binding: BOUND
12:16:23  INFO: Check ALM binding of project 'myorg_org-user-view' (done) | time=194ms
12:16:23  INFO: Load project pull requests
12:16:23  INFO: Load project pull requests (done) | time=192ms
12:16:23  INFO: Load branch configuration
12:16:23  INFO: Load branch configuration (done) | time=2ms
12:16:23  INFO: Load quality profiles
12:16:23  INFO: Load quality profiles (done) | time=249ms
12:16:23  INFO: Load active rules
12:16:31  INFO: Load active rules (done) | time=6612ms
12:16:31  INFO: Organization key: myorg-github
12:16:31  INFO: Branch name: org-15988, type: short-lived
12:16:31  INFO: Load project repositories
12:16:31  INFO: Load project repositories (done) | time=244ms
12:16:31  INFO: SCM collecting changed files in the branch
12:16:31  INFO: SCM collecting changed files in the branch (done) | time=86ms
12:16:31  INFO: Indexing files...
12:16:31  INFO: Project configuration:
12:16:31  INFO:   Excluded sources: **/build-wrapper-dump.json
12:16:31  INFO:   Excluded tests: node_modules/**, **/*.spec.ts
12:16:37  INFO: 99 files indexed
12:16:37  INFO: 0 files ignored because of inclusion/exclusion patterns
12:16:37  INFO: 40763 files ignored because of scm ignore settings
12:16:37  INFO: Quality profile for js: Sonar way
12:16:37  INFO: Quality profile for json: SonarQube Way
12:16:37  INFO: Quality profile for ts: Sonar way
12:16:37  INFO: Quality profile for yaml: Sonar way
12:16:37  INFO: ------------- Run sensors on module myorg_org-user-view
12:16:37  INFO: Load metrics repository
12:16:37  INFO: Load metrics repository (done) | time=198ms
12:16:38  INFO: Sensor IaC CloudFormation Sensor [iac]
12:16:38  INFO: 4 source files to be analyzed
12:16:39  INFO: 4/4 source files have been analyzed
12:16:39  INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=492ms
12:16:39  INFO: Sensor C# Project Type Information [csharp]
12:16:39  INFO: Sensor C# Project Type Information [csharp] (done) | time=1ms
12:16:39  INFO: Sensor C# Analysis Log [csharp]
12:16:39  INFO: Sensor C# Analysis Log [csharp] (done) | time=11ms
12:16:39  INFO: Sensor C# Properties [csharp]
12:16:39  INFO: Sensor C# Properties [csharp] (done) | time=0ms
12:16:39  INFO: Sensor HTML [web]
12:16:39  INFO: Sensor HTML [web] (done) | time=5ms
12:16:39  INFO: Sensor Text Sensor [text]
12:16:39  INFO: 92 source files to be analyzed
12:16:39  INFO: 92/92 source files have been analyzed
12:16:39  INFO: Sensor Text Sensor [text] (done) | time=79ms
12:16:39  INFO: Sensor VB.NET Project Type Information [vbnet]
12:16:39  INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
12:16:39  INFO: Sensor VB.NET Analysis Log [vbnet]
12:16:39  INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=11ms
12:16:39  INFO: Sensor VB.NET Properties [vbnet]
12:16:39  INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
12:16:39  INFO: Sensor JaCoCo XML Report Importer [jacoco]
12:16:39  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
12:16:39  INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
12:16:39  INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms
12:16:39  INFO: Sensor JavaScript analysis [javascript]
12:16:47  INFO: Deploying custom rules bundle jar:file:/var/lib/jenkins/.sonar/cache/c8528df5e461867acf060f71702dbe39/sonar-securityjsfrontend-plugin.jar!/js-vulnerabilities-rules-1.0.0.tgz to /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules17431294334707813096
12:16:48  INFO: 10 source files to be analyzed
12:16:56  INFO: 10/10 source files have been analyzed
12:16:56  INFO: Sensor JavaScript analysis [javascript] (done) | time=16414ms
12:16:56  INFO: Sensor TypeScript analysis [javascript]
12:16:56  INFO: Found 4 tsconfig.json file(s): [/var/lib/jenkins/workspace/er-delete-and-exclude-attributes/api-tests/config/tsconfig.json, /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/api-tests/compiled_smoke_tests/api-tests/config/tsconfig.json, /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/api-tests/compiled_tests/api-tests/config/tsconfig.json, /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/tsconfig.json]
12:16:56  INFO: 65 source files to be analyzed
12:16:56  INFO: Creating TypeScript program
12:16:56  INFO: TypeScript configuration file /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/api-tests/config/tsconfig.json
12:17:00  INFO: Creating TypeScript program (done) | time=4050ms
12:17:00  INFO: Starting analysis with current program
12:17:03  INFO: Analyzed 20 file(s) with current program
12:17:03  INFO: Creating TypeScript program
12:17:03  INFO: TypeScript configuration file /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/api-tests/compiled_smoke_tests/api-tests/config/tsconfig.json
12:17:03  INFO: Creating TypeScript program (done) | time=319ms
12:17:03  INFO: Starting analysis with current program
12:17:03  INFO: Analyzed 0 file(s) with current program
12:17:03  INFO: Creating TypeScript program
12:17:03  INFO: TypeScript configuration file /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/api-tests/compiled_tests/api-tests/config/tsconfig.json
12:17:03  INFO: Creating TypeScript program (done) | time=329ms
12:17:03  INFO: Starting analysis with current program
12:17:03  INFO: Analyzed 0 file(s) with current program
12:17:03  INFO: Creating TypeScript program
12:17:03  INFO: TypeScript configuration file /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/tsconfig.json
12:17:06  INFO: 20/65 files analyzed, current file: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/src/test-utils/mocks/mockSNSMessage.mock.ts
12:17:07  INFO: Creating TypeScript program (done) | time=3765ms
12:17:07  INFO: Starting analysis with current program
12:17:11  INFO: Analyzed 44 file(s) with current program
12:17:11  INFO: Skipped 1 file(s) because they were not part of any tsconfig (enable debug logs to see the full list)
12:17:11  INFO: 65/65 source files have been analyzed
12:17:11  INFO: Sensor TypeScript analysis [javascript] (done) | time=15241ms
12:17:11  INFO: Sensor CSS Rules [javascript]
12:17:11  INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
12:17:11  INFO: Sensor CSS Rules [javascript] (done) | time=0ms
12:17:11  INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]
12:17:11  INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=1ms
12:17:11  INFO: Sensor Serverless configuration file sensor [security]
12:17:11  INFO: 0 Serverless function entries were found in the project
12:17:11  INFO: 0 Serverless function handlers were kept as entrypoints
12:17:11  INFO: Sensor Serverless configuration file sensor [security] (done) | time=3ms
12:17:11  INFO: Sensor AWS SAM template file sensor [security]
12:17:11  WARN: Could not find handler file corresponding to 'dist/corsOptions/corsOptions.*'
12:17:11  WARN: Could not find handler file corresponding to 'dist/healthGet/healthGet.*'
12:17:11  WARN: Could not find handler file corresponding to 'dist/userSearch/userSearch.*'
12:17:11  INFO: Sensor AWS SAM template file sensor [security] (done) | time=104ms
12:17:11  INFO: Sensor JavaSecuritySensor [security]
12:17:11  INFO: Reading type hierarchy from: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/.scannerwork/ucfg2/java
12:17:11  INFO: Read 0 type definitions
12:17:11  INFO: Reading UCFGs from: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/.scannerwork/ucfg2/java
12:17:11  INFO: No UCFGs have been included for analysis.
12:17:11  INFO: Sensor JavaSecuritySensor [security] (done) | time=2ms
12:17:11  INFO: Sensor CSharpSecuritySensor [security]
12:17:11  INFO: Reading type hierarchy from: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/ucfg_cs2
12:17:11  INFO: Read 0 type definitions
12:17:11  INFO: Reading UCFGs from: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/ucfg_cs2
12:17:11  INFO: No UCFGs have been included for analysis.
12:17:11  INFO: Sensor CSharpSecuritySensor [security] (done) | time=1ms
12:17:11  INFO: Sensor PhpSecuritySensor [security]
12:17:11  INFO: Reading type hierarchy from: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/.scannerwork/ucfg2/php
12:17:11  INFO: Read 0 type definitions
12:17:11  INFO: Reading UCFGs from: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/.scannerwork/ucfg2/php
12:17:11  INFO: No UCFGs have been included for analysis.
12:17:11  INFO: Sensor PhpSecuritySensor [security] (done) | time=0ms
12:17:11  INFO: Sensor PythonSecuritySensor [security]
12:17:11  INFO: Reading type hierarchy from: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/.scannerwork/ucfg2/python
12:17:11  INFO: Read 0 type definitions
12:17:11  INFO: Reading UCFGs from: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/.scannerwork/ucfg2/python
12:17:11  INFO: No UCFGs have been included for analysis.
12:17:11  INFO: Sensor PythonSecuritySensor [security] (done) | time=0ms
12:17:11  INFO: Sensor JsSecuritySensor [security]
12:17:11  INFO: Reading type hierarchy from: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/.scannerwork/ucfg2/js
12:17:11  INFO: Read 0 type definitions
12:17:11  INFO: Reading UCFGs from: /var/lib/jenkins/workspace/er-delete-and-exclude-attributes/.scannerwork/ucfg2/js
12:17:11  INFO: 12:17:11.074295 Building Runtime Type propagation graph
12:17:11  INFO: 12:17:11.100727 Running Tarjan on 2515 nodes
12:17:11  INFO: 12:17:11.107794 Tarjan found 2515 components
12:17:11  INFO: 12:17:11.115442 Variable type analysis: done
12:17:11  INFO: 12:17:11.11689 Building Runtime Type propagation graph
12:17:11  INFO: 12:17:11.136151 Running Tarjan on 2515 nodes
12:17:11  INFO: 12:17:11.138467 Tarjan found 2515 components
12:17:11  INFO: 12:17:11.142175 Variable type analysis: done
12:17:11  INFO: Analyzing 364 ucfgs to detect vulnerabilities.
12:17:11  INFO: Taint analysis starting. Entrypoints: 76
12:17:11  INFO: Running symbolic analysis for 'JS'
12:17:12  INFO: Taint analysis: done.
12:17:12  INFO: Sensor JsSecuritySensor [security] (done) | time=994ms
12:17:12  INFO: ------------- Run sensors on project
12:17:12  INFO: Sensor Zero Coverage Sensor
12:17:12  INFO: Sensor Zero Coverage Sensor (done) | time=15ms
12:17:12  INFO: SCM Publisher SCM provider for this project is: git
12:17:12  INFO: SCM Publisher 18 source files to be analyzed
12:17:12  INFO: SCM Publisher 18/18 source files have been analyzed (done) | time=151ms
12:17:12  INFO: CPD Executor 13 files had no CPD blocks
12:17:12  INFO: CPD Executor Calculating CPD for 61 files
12:17:12  INFO: CPD Executor CPD calculation finished (done) | time=25ms
12:17:12  INFO: SCM writing changed lines
12:17:12  INFO: SCM writing changed lines (done) | time=148ms
12:17:12  INFO: Analysis report generated in 275ms, dir size=329 KB
12:17:12  INFO: Analysis report compressed in 141ms, zip size=143 KB
12:17:13  INFO: Analysis report uploaded in 545ms
12:17:13  INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=myresults
12:17:13  INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
12:17:13  INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=myid
12:17:19  INFO: Analysis total time: 56.545 s
12:17:19  INFO: ------------------------------------------------------------------------
12:17:19  INFO: EXECUTION SUCCESS
12:17:19  INFO: ------------------------------------------------------------------------
12:17:19  INFO: Total time: 1:32.929s
12:17:19  INFO: Final Memory: 46M/174M

But all out projects appear like this:

Is there anything that we are missing ?
Any help would be appreciated.

Regards,
Alfredo Palhares

Hey there.

You need to make sure you pass your coverage report to the sonar.javascript.lcov.reportPaths analysis parameter.