Codecov

Code coverage done right.®

Welcome to Codecov Documentation. You'll find comprehensive guides and documentation to help you start working with Codecov as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

Testing with Docker

Running tests inside a Docker container is a popular technique, and with one small extra step Codecov will integrate seamlessly. Because of the containerization, reports generated in the container are not retrievable outside of it, but we have two techniques to help Codecov collect reports.

Codecov Inside Docker

The easiest and most popular technique is to pass environment variables through the container.

# request codecov to detect CI environment to pass through to docker
ci_env=`bash <(curl -s https://codecov.io/env)`
docker run $ci_env ...
   |----- inside docker container
   | # exec tests
   | bash <(curl -s https://codecov.io/bash)

Codecov Outside Docker

Pass coverage reports out of the container through a mounted directory, and then run Codecov. This requires you to know the report files and where to put them.

# create a shared folder to store reports in
mkdir shared
# include shared folder when running docker
# make sure you move your reports into the shared folder while in docker
docker run -v "$PWD/shared:/shared" ...
   |----- inside docker container
   | # run test
   | mv coverage.txt shared
# now run codecov in project directory to discover reports in shared folder
bash <(curl -s https://codecov.io/bash)

Updated 10 months ago


Testing with Docker


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.