Incorrect coverage for React TypeScript files (.tsx)

  • ALM used - GitHub
  • CI system used - Circle CI
  • Languages of the repository - TypeScript, React

Hey, :wave:
I’m having an issue with coverage reporting.
Our project is using React and TypeScript. Tests run with Vitest (v1.6.0) and reports using v8 to lcov format. SonarCloud sees the JSX part of react component as not covered, although they are.
This is the first project we have with React that uses SonarCloud. It’s using monorepo approach. Test run for all the repository, but SC project is configured per domain (folder in the repository), so each folder can have it’s own configuration.

Happy to provide more info as needed.

SonarCloud app:

Screenshot of html report
Screenshot 2024-06-18 at 14.38.25

lcov data:

TN:
SF:storage/components/TestComp/TestComp.tsx
FN:3,TestComp
FNF:1
FNH:1
FNDA:1,TestComp
DA:1,1
DA:2,1
DA:3,1
DA:4,1
DA:5,1
LF:5
LH:5
BRDA:3,0,0,1
BRF:1
BRH:1
end_of_record

Coverage report from v8:

-------------------|---------|----------|---------|---------|-------------------
File               | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-------------------|---------|----------|---------|---------|-------------------

 ...nents/TestComp |     100 |      100 |     100 |     100 |                   
  TestComp.tsx     |     100 |      100 |     100 |     100 |                   
 
-------------------|---------|----------|---------|---------|-------------------

Log:

INFO: Scanner configuration file: /tmp/cache/scanner/sonar-scanner-5.0.1.3006-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: /tmp/workspace/src/storage/sonar-project.properties
INFO: SonarScanner 5.0.1.3006
INFO: Java 17.0.7 Eclipse Adoptium (64-bit)
INFO: Linux 5.15.0-1057-aws amd64
INFO: User cache: /tmp/cache/scanner/.sonar/cache
INFO: Analyzing on SonarCloud
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=415ms
INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
INFO: Loading required plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=124ms
INFO: Load/download plugins
INFO: Load/download plugins (done) | time=109ms
INFO: Found an active CI vendor: 'CircleCI'
INFO: Load project settings for component key: '%%%%%%%%%%%%'
INFO: Load project settings for component key: '%%%%%%%%%%%%' (done) | time=123ms
INFO: Process project properties
INFO: Project key: %%%%%%%%%%%%
INFO: Base dir: /tmp/workspace/src/storage
INFO: Working dir: /tmp/workspace/src/storage/.scannerwork
INFO: Load project branches
INFO: Load project branches (done) | time=134ms
INFO: Check ALM binding of project '%%%%%%%%%%%%'
INFO: Detected project binding: BOUND
INFO: Check ALM binding of project '%%%%%%%%%%%%' (done) | time=109ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=159ms
INFO: Load branch configuration
INFO: Auto-configuring pull request 2041
INFO: Load branch configuration (done) | time=747ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=218ms
INFO: Load active rules
INFO: Load active rules (done) | time=5908ms
INFO: Organization key: ~~~~~~~~
INFO: Pull request 2041 for merge into master from pt-4855-sonarcloud-introduction
INFO: Preprocessing files...
INFO: 1 language detected in 255 preprocessed files
INFO: 53 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Loading plugins for detected languages
INFO: Load/download plugins
INFO: Load/download plugins (done) | time=27ms
INFO: Load project repositories
INFO: Load project repositories (done) | time=133ms
INFO: SCM collecting changed files in the branch
INFO: SCM collecting changed files in the branch (done) | time=156ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: **/build-wrapper-dump.json, **/*.test.ts, **/*.test.tsx
INFO:   Included tests: **/*.test.ts, **/*.test.tsx
INFO: 255 files indexed
INFO: Quality profile for ts: Sonar way
INFO: ------------- Run sensors on module %%%%%%%%%%%%
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=107ms
INFO: Sensor cache enabled
INFO: Load sensor cache
INFO: Load sensor cache (404) | time=334ms
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=2ms
INFO: Sensor Java Config Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor Java Config Sensor [iac] (done) | time=37ms
INFO: Sensor JavaScript/TypeScript analysis [javascript]
INFO: Detected os: Linux arch: amd64 alpine: false. Platform: LINUX_X64
INFO: Using embedded Node.js runtime
INFO: Using Node.js executable: '/tmp/cache/scanner/.sonar/js/node-runtime/node'.
INFO: Memory configuration: OS (70213 MB), Node.js (2096 MB).
INFO: Found 0 tsconfig.json file(s): []
INFO: 253 source files to be analyzed
INFO: Creating TypeScript program
INFO: TypeScript configuration file /tmp/tmp-186-zTXhqxoNPKnW
INFO: Starting analysis with current program
INFO: Analyzed 253 file(s) with current program
INFO: 253/253 source files have been analyzed
INFO: Hit the cache for 0 out of 253
INFO: Miss the cache for 253 out of 253: FILE_CHANGED [253/253]
INFO: Sensor JavaScript/TypeScript analysis [javascript] (done) | time=16038ms
INFO: Sensor CSS Rules [javascript]
INFO: Sensor CSS Rules is restricted to changed files only
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor CSS Rules [javascript] (done) | time=1ms
INFO: Sensor JavaScript/TypeScript Coverage [javascript]
INFO: Analysing [/tmp/workspace/src/storage/../../coverage/lcov.info]
WARN: Could not resolve 984 file paths in [/tmp/workspace/src/storage/../../coverage/lcov.info]
WARN: First unresolved path: ../public/mockServiceWorker.js (Run in DEBUG mode to get full list of unresolved paths)
WARN: Found 13 inconsistencies in coverage report. Re-run analyse in debug mode to see details.
INFO: Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=33ms
INFO: Sensor IaC Docker Sensor [iac]
INFO: Sensor IaC Docker Sensor is restricted to changed files only
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC Docker Sensor [iac] (done) | time=57ms
INFO: Sensor Serverless configuration file sensor [security]
INFO: 0 Serverless function entries were found in the project
INFO: 0 Serverless function handlers were kept as entrypoints
INFO: Sensor Serverless configuration file sensor [security] (done) | time=3ms
INFO: Sensor AWS SAM template file sensor [security]
INFO: Sensor AWS SAM template file sensor [security] (done) | time=1ms
INFO: Sensor AWS SAM Inline template file sensor [security]
INFO: Sensor AWS SAM Inline template file sensor [security] (done) | time=1ms
INFO: Sensor TextAndSecretsSensor [text]
INFO: Sensor TextAndSecretsSensor is restricted to changed files only
INFO: Available processors: 4
INFO: Using 4 threads for analysis.
INFO: The property "sonar.tests" is not set. To improve the analysis accuracy, we categorize a file as a test file if any of the following is true:
  * The filename starts with "test"
  * The filename contains "test." or "tests."
  * Any directory in the file path is named: "doc", "docs", "test" or "tests"
  * Any directory in the file path has a name ending in "test" or "tests"

INFO: 2 source files to be analyzed
INFO: 2/2 source files have been analyzed
INFO: Sensor TextAndSecretsSensor [text] (done) | time=825ms
INFO: Sensor JavaSecuritySensor [security]
INFO: Enabled taint analysis rules: S2076, S2078, S2083, S2091, S2631, S3649, S5131, S5135, S5144, S5145, S5146, S5147, S5334, S5883, S6096, S6173, S6287, S6350, S6384, S6390, S6398, S6399, S6547, S6549
INFO: Load type hierarchy and UCFGs: Starting
INFO: Load type hierarchy: Starting
INFO: Reading type hierarchy from: /tmp/workspace/src/storage/.scannerwork/ucfg2/java
INFO: Read 0 type definitions
INFO: Load type hierarchy: Time spent was 00:00:00.002
INFO: Load UCFGs: Starting
INFO: Load UCFGs: Time spent was 00:00:00.000
INFO: Load type hierarchy and UCFGs: Time spent was 00:00:00.002
INFO: No UCFGs have been included for analysis.
INFO: java security sensor: Time spent was 00:00:00.013
INFO: java security sensor: Begin: 2024-06-18T12:31:47.308431726Z, End: 2024-06-18T12:31:47.322014091Z, Duration: 00:00:00.013
  Load type hierarchy and UCFGs: Begin: 2024-06-18T12:31:47.310252243Z, End: 2024-06-18T12:31:47.312755696Z, Duration: 00:00:00.002
    Load type hierarchy: Begin: 2024-06-18T12:31:47.310331482Z, End: 2024-06-18T12:31:47.312348887Z, Duration: 00:00:00.002
    Load UCFGs: Begin: 2024-06-18T12:31:47.312588950Z, End: 2024-06-18T12:31:47.312655807Z, Duration: 00:00:00.000
INFO: java security sensor peak memory: 133 MB
INFO: Sensor JavaSecuritySensor [security] (done) | time=18ms
INFO: Sensor CSharpSecuritySensor [security]
INFO: Enabled taint analysis rules: S2076, S2078, S2083, S2091, S2631, S3649, S5131, S5135, S5144, S5145, S5146, S5334, S5883, S6096, S6173, S6287, S6350, S6399, S6639, S6641
INFO: Load type hierarchy and UCFGs: Starting
INFO: Load type hierarchy: Starting
INFO: Reading type hierarchy from: /tmp/workspace/src/storage/ucfg2/cs
INFO: Read 0 type definitions
INFO: Load type hierarchy: Time spent was 00:00:00.000
INFO: Load UCFGs: Starting
INFO: Load UCFGs: Time spent was 00:00:00.000
INFO: Load type hierarchy and UCFGs: Time spent was 00:00:00.000
INFO: No UCFGs have been included for analysis.
INFO: csharp security sensor: Time spent was 00:00:00.001
INFO: csharp security sensor: Begin: 2024-06-18T12:31:47.324495136Z, End: 2024-06-18T12:31:47.325607610Z, Duration: 00:00:00.001
  Load type hierarchy and UCFGs: Begin: 2024-06-18T12:31:47.324697453Z, End: 2024-06-18T12:31:47.325271586Z, Duration: 00:00:00.000
    Load type hierarchy: Begin: 2024-06-18T12:31:47.324728238Z, End: 2024-06-18T12:31:47.325033991Z, Duration: 00:00:00.000
    Load UCFGs: Begin: 2024-06-18T12:31:47.325137751Z, End: 2024-06-18T12:31:47.325194809Z, Duration: 00:00:00.000
INFO: csharp security sensor peak memory: 133 MB
INFO: Sensor CSharpSecuritySensor [security] (done) | time=2ms
INFO: Sensor PhpSecuritySensor [security]
INFO: Enabled taint analysis rules: S2076, S2078, S2083, S2091, S2631, S3649, S5131, S5135, S5144, S5145, S5146, S5334, S5335, S5883, S6173, S6287, S6350
INFO: Load type hierarchy and UCFGs: Starting
INFO: Load type hierarchy: Starting
INFO: Reading type hierarchy from: /tmp/workspace/src/storage/.scannerwork/ucfg2/php
INFO: Read 0 type definitions
INFO: Load type hierarchy: Time spent was 00:00:00.000
INFO: Load UCFGs: Starting
INFO: Load UCFGs: Time spent was 00:00:00.000
INFO: Load type hierarchy and UCFGs: Time spent was 00:00:00.000
INFO: No UCFGs have been included for analysis.
INFO: php security sensor: Time spent was 00:00:00.000
INFO: php security sensor: Begin: 2024-06-18T12:31:47.326375641Z, End: 2024-06-18T12:31:47.327207132Z, Duration: 00:00:00.000
  Load type hierarchy and UCFGs: Begin: 2024-06-18T12:31:47.326561075Z, End: 2024-06-18T12:31:47.326911636Z, Duration: 00:00:00.000
    Load type hierarchy: Begin: 2024-06-18T12:31:47.326582194Z, End: 2024-06-18T12:31:47.326722644Z, Duration: 00:00:00.000
    Load UCFGs: Begin: 2024-06-18T12:31:47.326809927Z, End: 2024-06-18T12:31:47.326838093Z, Duration: 00:00:00.000
INFO: php security sensor peak memory: 133 MB
INFO: Sensor PhpSecuritySensor [security] (done) | time=1ms
INFO: Sensor PythonSecuritySensor [security]
INFO: Enabled taint analysis rules: S2076, S2078, S2083, S2091, S2631, S3649, S5131, S5135, S5144, S5145, S5146, S5147, S5334, S5496, S6287, S6350, S6639, S6680, S6776, S6839
INFO: Load type hierarchy and UCFGs: Starting
INFO: Load type hierarchy: Starting
INFO: Reading type hierarchy from: /tmp/workspace/src/storage/.scannerwork/ucfg2/python
INFO: Read 0 type definitions
INFO: Load type hierarchy: Time spent was 00:00:00.000
INFO: Load UCFGs: Starting
INFO: Load UCFGs: Time spent was 00:00:00.000
INFO: Load type hierarchy and UCFGs: Time spent was 00:00:00.000
INFO: No UCFGs have been included for analysis.
INFO: python security sensor: Time spent was 00:00:00.000
INFO: python security sensor: Begin: 2024-06-18T12:31:47.328082176Z, End: 2024-06-18T12:31:47.328859811Z, Duration: 00:00:00.000
  Load type hierarchy and UCFGs: Begin: 2024-06-18T12:31:47.328245290Z, End: 2024-06-18T12:31:47.328555037Z, Duration: 00:00:00.000
    Load type hierarchy: Begin: 2024-06-18T12:31:47.328266370Z, End: 2024-06-18T12:31:47.328366283Z, Duration: 00:00:00.000
    Load UCFGs: Begin: 2024-06-18T12:31:47.328450432Z, End: 2024-06-18T12:31:47.328478049Z, Duration: 00:00:00.000
INFO: python security sensor peak memory: 133 MB
INFO: Sensor PythonSecuritySensor [security] (done) | time=1ms
INFO: Sensor JsSecuritySensor [security]
INFO: Enabled taint analysis rules: S5144, S5334, S5147, S2631, S5696, S2076, S6350, S5146, S3649, S6096, S2083, S5883, S5131, S6105, S6287
INFO: Load type hierarchy and UCFGs: Starting
INFO: Load type hierarchy: Starting
INFO: Reading type hierarchy from: /tmp/workspace/src/storage/.scannerwork/ucfg2/js
INFO: Read 0 type definitions
INFO: Load type hierarchy: Time spent was 00:00:00.004
INFO: Load UCFGs: Starting
INFO: Reading UCFGs from: /tmp/workspace/src/storage/.scannerwork/ucfg2/js
INFO: Load UCFGs: Time spent was 00:00:00.612
INFO: Load type hierarchy and UCFGs: Time spent was 00:00:00.617
INFO: Analyzing 1041 UCFGs to detect vulnerabilities.
INFO: Check cache: Starting
INFO: Load cache: Starting
INFO: Load cache: Time spent was 00:00:00.000
INFO: Check cache: Time spent was 00:00:00.000
INFO: Create runtime call graph: Starting
INFO: Variable Type Analysis #1: Starting
INFO: Create runtime type propagation graph: Starting
INFO: Create runtime type propagation graph: Time spent was 00:00:00.095
INFO: Run SCC (Tarjan) on 10092 nodes: Starting
INFO: Run SCC (Tarjan) on 10092 nodes: Time spent was 00:00:00.019
INFO: Tarjan found 10092 strongly connected components
INFO: Propagate runtime types to strongly connected components: Starting
INFO: Propagate runtime types to strongly connected components: Time spent was 00:00:00.038
INFO: Variable Type Analysis #1: Time spent was 00:00:00.156
INFO: Variable Type Analysis #2: Starting
INFO: Create runtime type propagation graph: Starting
INFO: Create runtime type propagation graph: Time spent was 00:00:00.109
INFO: Run SCC (Tarjan) on 10092 nodes: Starting
INFO: Run SCC (Tarjan) on 10092 nodes: Time spent was 00:00:00.014
INFO: Tarjan found 10092 strongly connected components
INFO: Propagate runtime types to strongly connected components: Starting
INFO: Propagate runtime types to strongly connected components: Time spent was 00:00:00.026
INFO: Variable Type Analysis #2: Time spent was 00:00:00.150
INFO: Create runtime call graph: Time spent was 00:00:00.311
INFO: Load config: Starting
INFO: Load config: Time spent was 00:00:00.076
INFO: Compute entry points: Starting
INFO: Compute entry points: Time spent was 00:00:00.448
INFO: All rules entry points : 254
INFO: Slice call graph: Starting
INFO: Slice call graph: Time spent was 00:00:00.000
INFO: Live variable analysis: Starting
INFO: Live variable analysis: Time spent was 00:00:00.313
INFO: Taint analysis for js: Starting
INFO: 0 / 1041 UCFGs simulated, memory usage: 153 MB
INFO: 123 / 1041 UCFGs simulated, memory usage: 104 MB
INFO: 260 / 1041 UCFGs simulated, memory usage: 197 MB
INFO: Taint analysis for js: Time spent was 00:00:05.839
INFO: Report issues: Starting
INFO: Report issues: Time spent was 00:00:00.002
INFO: Store cache: Starting
INFO: Store cache: Time spent was 00:00:00.000
INFO: js security sensor: Time spent was 00:00:07.611
INFO: js security sensor: Begin: 2024-06-18T12:31:47.329576187Z, End: 2024-06-18T12:31:54.941412974Z, Duration: 00:00:07.611
  Load type hierarchy and UCFGs: Begin: 2024-06-18T12:31:47.329773686Z, End: 2024-06-18T12:31:47.946941699Z, Duration: 00:00:00.617
    Load type hierarchy: Begin: 2024-06-18T12:31:47.329803845Z, End: 2024-06-18T12:31:47.334194805Z, Duration: 00:00:00.004
    Load UCFGs: Begin: 2024-06-18T12:31:47.334386304Z, End: 2024-06-18T12:31:47.946741279Z, Duration: 00:00:00.612
  Check cache: Begin: 2024-06-18T12:31:47.947025728Z, End: 2024-06-18T12:31:47.947572844Z, Duration: 00:00:00.000
    Load cache: Begin: 2024-06-18T12:31:47.947049927Z, End: 2024-06-18T12:31:47.947193313Z, Duration: 00:00:00.000
  Create runtime call graph: Begin: 2024-06-18T12:31:47.947673334Z, End: 2024-06-18T12:31:48.258805151Z, Duration: 00:00:00.311
    Variable Type Analysis #1: Begin: 2024-06-18T12:31:47.948394856Z, End: 2024-06-18T12:31:48.104700263Z, Duration: 00:00:00.156
      Create runtime type propagation graph: Begin: 2024-06-18T12:31:47.949193390Z, End: 2024-06-18T12:31:48.045182166Z, Duration: 00:00:00.095
      Run SCC (Tarjan) on 10092 nodes: Begin: 2024-06-18T12:31:48.045679597Z, End: 2024-06-18T12:31:48.065402602Z, Duration: 00:00:00.019
      Propagate runtime types to strongly connected components: Begin: 2024-06-18T12:31:48.065679909Z, End: 2024-06-18T12:31:48.104500855Z, Duration: 00:00:00.038
    Variable Type Analysis #2: Begin: 2024-06-18T12:31:48.106535179Z, End: 2024-06-18T12:31:48.257019441Z, Duration: 00:00:00.150
      Create runtime type propagation graph: Begin: 2024-06-18T12:31:48.106727769Z, End: 2024-06-18T12:31:48.216135855Z, Duration: 00:00:00.109
      Run SCC (Tarjan) on 10092 nodes: Begin: 2024-06-18T12:31:48.216336345Z, End: 2024-06-18T12:31:48.230480826Z, Duration: 00:00:00.014
      Propagate runtime types to strongly connected components: Begin: 2024-06-18T12:31:48.230690727Z, End: 2024-06-18T12:31:48.256848550Z, Duration: 00:00:00.026
  Load config: Begin: 2024-06-18T12:31:48.258960441Z, End: 2024-06-18T12:31:48.335130338Z, Duration: 00:00:00.076
  Compute entry points: Begin: 2024-06-18T12:31:48.335316037Z, End: 2024-06-18T12:31:48.784198127Z, Duration: 00:00:00.448
  Slice call graph: Begin: 2024-06-18T12:31:48.784364482Z, End: 2024-06-18T12:31:48.784380891Z, Duration: 00:00:00.000
  Live variable analysis: Begin: 2024-06-18T12:31:48.784413282Z, End: 2024-06-18T12:31:49.097827975Z, Duration: 00:00:00.313
  Taint analysis for js: Begin: 2024-06-18T12:31:49.098227473Z, End: 2024-06-18T12:31:54.937525910Z, Duration: 00:00:05.839
  Report issues: Begin: 2024-06-18T12:31:54.937624038Z, End: 2024-06-18T12:31:54.940526933Z, Duration: 00:00:00.002
  Store cache: Begin: 2024-06-18T12:31:54.940624986Z, End: 2024-06-18T12:31:54.940664501Z, Duration: 00:00:00.000
INFO: js security sensor peak memory: 222 MB
INFO: Sensor JsSecuritySensor [security] (done) | time=7613ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=23ms
INFO: SCM Publisher SCM provider for this project is: git
INFO: SCM Publisher 1 source file to be analyzed
INFO: SCM Publisher 1/1 source file have been analyzed (done) | time=41ms
INFO: CPD Executor 78 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 175 files
INFO: CPD Executor CPD calculation finished (done) | time=129ms
INFO: SCM writing changed lines
INFO: SCM writing changed lines (done) | time=26ms
INFO: Analysis report generated in 138ms, dir size=424 KB
INFO: Analysis report compressed in 169ms, zip size=249 KB
INFO: Analysis report uploaded in 807ms
INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=%%%%%%%%%%%%&pullRequest=2041
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 https://sonarcloud.io/api/ce/task?id=AZArVRrz7hl-GGcQFltU
INFO: Time spent writing ucfgs 560ms
INFO: Analysis total time: 37.246 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 43.468s
INFO: Final Memory: 96M/235M
INFO: ------------------------------------------------------------------------

Hi,

Thanks for this thorough initial report!

The logs and screenshots are particularly helpful.

Looking at your SonarCloud screenshot, the single uncovered line - versus the full coverage shown in the HTML report - tells me that the file was not found in the coverage report and analysis fell back to executable lines. (This points to SQ docs instead of SC, but it’s the same implementation.)

So I know there’s a problem with the coverage report import. Then I check the analysis logs, and there it is:

WARN: Could not resolve 984 file paths in [/tmp/workspace/src/storage/../../coverage/lcov.info]
WARN: First unresolved path: ../public/mockServiceWorker.js (Run in DEBUG mode to get full list of unresolved paths)
WARN: Found 13 inconsistencies in coverage report. Re-run analyse in debug mode to see details.

This is a problem with the paths in the report, likely caused by this:

So the coverage report paths start from a directory above where analysis is running and the paths don’t match what analysis sees.

The options I see are to either pre-process the coverage report to ‘correct’ the paths or change how you run coverage to a project-by-project basis.

 
HTH,
Ann

Thanks for the quick reply. I thought that since some of the lines were covered, it means that the TestComp.tsx file was not one of the “could not resolve” files.
None of the options is easy to solve, but let’s see how it goes.

Ended up creating a post processing script to fix paths and remove irrelevant coverage files from the original lcov.info. The result file is passed in configuration

sonar.javascript.lcov.reportPaths=coverage/dir-name.lcov.info
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.