Lcov report points to js files, how to map this to the ts files?

Hello,

we have a typescript project that execute tests as javascript, so the generated lcov file point to the generated js file of the src files. We excluded the generated js files from the sonarqube, as we would like to get the analysis for the ts files.

If the generate a Cobertura Report, the coverage date is correctly mapped to the src files. This was done by config the report to use the generated sourceMap js.map files.

But the sonarqube step to run scanner and upload the results to the SonarQube Server, reports the warning that it not resolve any file paths in [/home/vsts/work/1/s/packages/core/report/unit/coverage/lcov.info] as there point to the js files and there are not there.

How would the correct setup look like?

  • do we need to provide the generated js files and should not exclude them?
  • can we provide the sourceMap js.map files together with the lcov file?

Hi,

Welcome to the community!

The paths in your coverage report need to match the paths analysis is seeing. You’ll need to either remove the exclusion, or somehow execute the TS versions.

 
HTH,
Ann

1 Like

Thanks Ann,

so that would mean we need add typescript code (that we write) and the generated JavaScript (created by the tsc + tsconfig) to the analyzed files.

run the the test on the generated JavaScript get the coverage for the JavaScript files but not for the typescript code.

We could exclude the typescript code from the coverage, but will still get the analyzed (rules checked) info on the typescript + javascript code.

Need to try this.

1 Like