My company is currently trying to implement Code Climate for test coverage. However, I do not have much idea about it and new to using code climate.

I tried to integrate code climate with Jenkins so that once the tests are successful, I can simply move on with other Jenkins Job.

I consulted the documentation itself, and as per documentation there are things like but there is not much explanation about it.

./cc-test-reporter after-build -t simplecov --exit-code $? || echo “Skipping Code Climate coverage upload”

I executed this, but returned there is no such file simplecov. I later found that the -t flag is used to provide the file which will be used for coverage. Below is my Jenkins job.

echo "---------------------------------------"
echo "| Downloading Code Climate "
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 >> ./cc-test-reporter
chmod +x ./cc-test-reporter
echo "| Download Complete "
echo "---------------------------------------"

echo "Running tests"
./cc-test-reporter before-build.

Once I execute this, I get the following output.

| Downloading Code Climate 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   178  100   178    0     0    933      0 --:--:-- --:--:-- --:--:--   936

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 12.1M  100 12.1M    0     0  10.0M      0  0:00:01  0:00:01 --:--:-- 15.8M
| Download Complete 
Running tests
Finished: SUCCESS

Why am I not getting any code coverage or things like that in the console. How do I properly integrate it in Jenkins.

UPDATE I have successfully created the job without issue. Now the problem I am facing is

$ ./cc-test-reporter format-coverage -t lcov coverage/lcov.info -d -o codeclimate.json
DEBU[0000] coverage path coverage/lcov.info             
DEBU[0000] using formatter lcov                         
DEBU[0000] checking search path coverage/lcov.info for lcov formatter 
DEBU[0000] couldn't load branch from ENV, trying git... 
DEBU[0000] couldn't load commit sha from ENV, trying git... 
DEBU[0000] couldn't load committed at from ENV, trying git... 
Error: could not find coverage info for source files

user@host:app$ pwd
user@host:app$ ll
user@host:app$ ll coverage

1 Answer 1


The issue has been resolved. This is for nodejs

Need to install necessary dependencies either using yarn or npm. Once done, run

nyc --reporter=lcov yarn unit unit
$ ./cc-test-reporter after-build -t lcov --exit-code $?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.