Typescript files not scanned

Hello,

I have a sample Angular application, which used to work on my Local SonarQube Server.

but since i have installed the server on an Azure VM, it is not detecting the Typescript files anymore (i doubt it has to do with the server, but it is the thing that has changed that i can think about).

SonarQube Version: 8.4.1.35646
Sonar Scanner Version: 4.4.0.2170

My sonar-project.properties file:

sonar.host.url=http://xxxxxxxxxx
sonar.login=xxxxxx
sonar.password=xxxxxx
sonar.projectKey=TestAngular
sonar.projectName=TestAngular
sonar.projectVersion=1.2
sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.exclusions=**/node_modules/**
sonar.tests=src
sonar.test.inclusions=**/*.spec.ts
sonar.typescript.lcov.reportPaths=coverage/lcov.info
sonar.typescript.tsconfigPath = tsconfig.app.json

and the output in the console is like:

PS D:\temp\angularHelloWorld\hello-world-angular> npm run sonar

> hello-world-angular@0.0.0 sonar D:\temp\angularHelloWorld\hello-world-angular
> sonar-scanner

INFO: Scanner configuration file: D:\temp\angularHelloWorld\hello-world-angular\node_modules\sonar-scanner\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: D:\temp\angularHelloWorld\hello-world-angular\sonar-project.properties
INFO: SonarQube Scanner 3.1.0.1141
INFO: Java 11.0.7 Oracle Corporation (64-bit)
INFO: Windows 10 10.0 amd64
INFO: User cache: C:\Users\LuayAbuShariha\.sonar\cache
INFO: SonarQube server 8.4.1
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=591ms
INFO: Server id: 32FADB56-AXNWm0c4r8JFD4Dyzu6V
INFO: User cache: C:\Users\LuayAbuShariha\.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=513ms
INFO: Load/download plugins (done) | time=584ms
INFO: Process project properties
INFO: Process project properties (done) | time=10ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=2ms
INFO: Project key: TestAngular
INFO: Base dir: D:\temp\angularHelloWorld\hello-world-angular
INFO: Working dir: D:\temp\angularHelloWorld\hello-world-angular\.scannerwork
INFO: Load project settings for component key: 'TestAngular'
INFO: Load project settings for component key: 'TestAngular' (done) | time=477ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=549ms
INFO: Load active rules
INFO: Load active rules (done) | time=8606ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: **/node_modules/**, **/*.spec.ts
INFO:   Included tests: **/*.spec.ts
INFO: Load project repositories
INFO: Load project repositories (done) | time=487ms
INFO: 19 files indexed
INFO: 19 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for css: Sonar way
INFO: Quality profile for ts: Sonar way
INFO: Quality profile for web: Sonar way
INFO: ------------- Run sensors on module TestAngular
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=487ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/C:/Users/LuayAbuShariha/.sonar/cache/d10bc58fef19b9375930c984f77df98d/sonar-javascript-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO: Sensor SonarCSS Metrics [cssfamily]
INFO: Sensor SonarCSS Metrics [cssfamily] (done) | time=35ms
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: 6 source files to be analyzed
INFO: 6/6 source files have been analyzed
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=2305ms
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=11ms
INFO: Sensor TypeScript analysis [javascript]
INFO: Using TypeScript at: 'D:\temp\angularHelloWorld\hello-world-angular\node_modules'
INFO: Using D:\temp\angularHelloWorld\hello-world-angular\tsconfig.app.json from sonar.typescript.tsconfigPath property
INFO: 9 source files to be analyzed
INFO: Skipping 7 files with no tsconfig.json
INFO: Analyzing 2 files using tsconfig: D:\temp\angularHelloWorld\hello-world-angular\tsconfig.app.json
INFO: Version of TypeScript used during analysis: 3.7.5
INFO: 9/9 source files have been analyzed
INFO: Sensor TypeScript analysis [javascript] (done) | time=6591ms
INFO: Sensor JavaScript/TypeScript Coverage [javascript]
WARN: The use of sonar.typescript.lcov.reportPaths for coverage import is deprecated, use sonar.javascript.lcov.reportPaths instead.
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: D:\temp\angularHelloWorld\hello-world-angular\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=11ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=1ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=35ms
INFO: Sensor SonarTS [typescript]
INFO: Since SonarTS v2.0, TypeScript analysis is performed by SonarJS analyzer v6.0 or later. No TypeScript analysis is performed by SonarTS.
INFO: Sensor SonarTS [typescript] (done) | time=7ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=15ms
INFO: SCM Publisher SCM provider for this project is: git
INFO: SCM Publisher 7 source files to be analyzed
INFO: SCM Publisher 7/7 source files have been analyzed (done) | time=211ms
INFO: CPD Executor 4 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 1 file
INFO: CPD Executor CPD calculation finished (done) | time=7ms
INFO: Analysis report generated in 76ms, dir size=90 KB
INFO: Analysis report compressed in 157ms, zip size=24 KB
INFO: Analysis report uploaded in 647ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://51.144.102.108/dashboard?id=TestAngular
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://51.144.102.108/api/ce/task?id=AXOZ4qgFB3WoycXix_wh
INFO: Analysis total time: 24.022 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 26.165s
INFO: Final Memory: 14M/57M
INFO: ------------------------------------------------------------------------

SonarQube shows that TS files are not covered:

Any hints what went wrong?

Regards

Hello Luay,

Thank you for your message!

As the logs emphasise, the scanner was not able to find the relevant file for line coverage:

INFO: Sensor JavaScript/TypeScript Coverage [javascript]
WARN: The use of sonar.typescript.lcov.reportPaths for coverage import is deprecated, use sonar.javascript.lcov.reportPaths instead.
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: D:\temp\angularHelloWorld\hello-world-angular\coverage\lcov.info
WARN: No coverage information will be saved because all LCOV files cannot be found.

One thing you can do first is to use sonar.javascript.lcov.reportPaths property instead for report paths as you are currently using a deprecated one.

On another note, please make sure that the file path D:\temp\angularHelloWorld\hello-world-angular\coverage\lcov.info does actually exist.

Yassin