Sonarqube with Jest reporting 0 coverage with both absolute and relative paths

I have an Angular project using Jest 29.5 for unit test coverage. I am getting the following error

"Could not resolve 199 file paths in [workspace/source/Content/angular-project/coverage/]

First unresolved path: Content/angular-project/src/app/app.component.html

My file begins with:


My jest.config.ts file has the following coverageReporters:

coverageReporters: ['html', ["lcovonly", {"projectRoot": "../../"}], 'text-summary'],

When I change my coverageReporters projectRoot to the absolute path, the file changes the file paths to be relative, so they do not match the relative path in the projectRoot provided. With both relative and absolute paths I am receiving this error. I have seen other responses suggesting sed cli to update the files, however my work does not allow this cli to be downloaded. How can I ensure sonarqube is able to resolve the paths?


Welcome to the community!

As you’ve probably seen in your research, this is caused by the paths in the coverage report not matching the paths analysis sees.

I’m no Jest expert, so I can only ask: would executing Jest from a different directory (presumably the same directory that analysis is kicked off from) get you a report with matching paths?


Hi Ann,

Thanks for the response.I was able to resolve this error however, and now I no longer get the error “cannot resolve file paths”, by removing “src” from moduleDirectories. However, Sonar is still not reporting coverage. Now I am getting the following:

Info: NO LCOV files were found using **coverage/
Info: Analyzing [workspace/source/Content/angular-project/coverage/]
Info: 0/0 source files have been analyzed

I was previously using Karma and it was reporting fine with the same coverage path and executing from the same directory as Jest is currently configured from. Sonarqube read the file from the same coverage directory without issue, so I can only assume since the only change was with Jest, it is an issue with the Jest configuration, however I was not sure if there is a sonarqube configuration that needed to be changed to work with Jest. I had to switch from Karma due to incompatibilities with other parts of the repo after I fixed some vulnerabilities. Currently Jest is the only other option my company supports for Angular, however my DevOps team has also not been able to help yet on why coverage is not reporting.


We don’t care what generated the report, only that it’s in a format we can understand.

Could we have the full analysis report?


Hi Ann,

The Plot Thickens! While looking for the reports, I found a second Sonar project connected to the same repo, and it turns out it is reporting coverage fine. For some reason we have 2 Sonar projects set up, and one shows the coverage, while the one linked on our Bitbucket repo shows no coverage. It looks like we’ll just need to remove the incorrectly built second project and all will be good.

Thank you for your help!


1 Like