Angular + Jest + Code Coverage + Azure devops - Could not resolve XXX file paths

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Sonarqube version: Community Edition - Version 7.9.1 (build 27448)

Tring to send lcov.info report to sonarqube server build using angular + jest + azure devops build pipeline.

Warning in console run code analysis task in azure build pipeline:
Could not resolve 571 file paths in [D:\a\1\s\Client\energysite\coverage\lcov.info], first unresolved path: projects\core\src\public-api.ts

sonar-properties:
sonar.sourceEncoding=UTF-8
sonar.sources=Client/energysite
sonar.exclusions=/node_modules/, /*.spec.ts
sonar.tests=Client/energysite
sonar.test.inclusions=
/*.spec.ts
sonar.typescript.lcov.reportPaths=Client/energysite/coverage/lcov.info
sonar.testExecutionReportPaths=Client/energysite/test-report.xml

Jest config:
coverageReporters: [“text-summary”, “lcov”, “cobertura”],

I tried change jest config to
coverageReporters: [“text-summary”, [“lcov”, {“projectRoot”: “\”], “cobertura”],

Could you help me, I could not able to publish code coverage lcov.info into sonar qube server,
SF path in lcov.info is set to “projects\core\src\public-api.ts”

Thanks,
Harish

Hi,

Welcome to the community!

First, your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.9.1 → 8.9.2 → 9.0.1 (last step optional)

Regarding your actual question, the key here is to have paths in your coverage report that match the paths analysis sees within your project. E.G. if you’re in the directory that analysis starts from, and you cd projects/core/src/ do you see public-api.ts?

 
HTH,
Ann

Hey Thanks.

I did solved it by setting.

coverageReporters: [“text-summary”, [“lcov”, {“projectRoot”: “…/…/…/”], “cobertura”],

I think this issue was not related to sonarqube but mis-understanding with folder structure.

Thanks,
Harish

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