Code coverage issue typescript project

Hi there! here is my sonar configs

  'sonar.organization': process.env.SONAR_ORG_TOKEN,
  'sonar.projectKey': projectKey,
  'sonar.projectName': projectName,
  'sonar.sources': sourceFiles,
  'sonar.tests': sourceFiles,
  'sonar.sourceEncoding': 'UTF-8',
  'sonar.javascript.lcov.reportPaths': reportPath,
  'sonar.test.inclusions': '**/*.spec.ts',
  'sonar.exclusions': '**/stack.*.ts,**/new-relic.js,**/new-relic.prod.js,**/node_modules/**,**/*.mock.ts'

During analysis returns WARN: Could not resolve 86 file paths on my lcov.info, i used verbose to see the logs and all my ts files are unresolved… after searching a bit I found some cases where they set the SF of the lcov with the absolute path, but it also didn’t work. Any idea?

Hi,

The paths should either be absolute from server root, or match what SonarQube sees in the analysis directory.

How did the paths in the report compare to paths that start from where analysis is kicked off?

 
Ann

Hi @ganncamp ,
Thank you for your answer

In both cases I am using the absolute path

Hi,

Was the LCOV report produced on the same build agent where you’re analyzing? I.e. are the file paths correct for the machine where analysis is running?

 
Ann

Yes they are, because they are not hardcoded for an absolute path, but dynamically elaborated on the machine where the analysis is performed, we do this via path.resolve

Hi,

So you’re saying you post-process your LCov report to make sure the paths match the absolute paths present on the analysis agent?

Anything unusual about these paths? Links or dots (e.g. ../ or /./)?

 
Ann