Unable to upload the code coverage to Codacy

Hi,

I’m using Codacy Cloud and following the Codacy documentation to upload the code coverage.

In step 2.3, I’m trying to run below command but I get this error everytime:-
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r report.xml

Error:-

2021-05-12 16:27:18.972Z  info [ReportRules] Parsing coverage data from: /Users/vinod827/go/mywork/mydevelopment/my-docker/report.xml ...  - (ReportRules.scala:43)
2021-05-12 16:27:18.972Z error [CodacyCoverageReporter] File /Users/vinod827/go/mywork/mydevelopment/my-docker/report.xml does not exist.  - (CodacyCoverageReporter.scala:25)

 --> Failed!

It is unable to find the report.xml file. I’m running a nodejs based project and using mocha and nyc libraries for the test and coverage. When I run npm test, I can see the test result but there is no such report.xml file.

This is my project on Github:-

May I know what is the issue and how can I finally start uploading the coverage report to Codacy?

Cheers

Hello @Vinod_Kumar, and welcome to the Codacy Community! :wave:

The error message means that the file report.xml doesn’t exist.

You must make sure that your test runs generate a coverage report in one of the formats that Codacy supports. I had a look at your project and noticed that you’re already generating a coverage/lcov.info coverage report, which is supported by Codacy. :white_check_mark:

Now, you need to specify the path to this coverage report when running the Codacy Coverage Reporter:

bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage/lcov.info

Let us know if this helps.

2 Likes