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

Common Recipe List

A list of common tasks and configurations

We've made a list of the most asked tasks and created a recipe guide on how to do them. I want to

Set status checks to block coverage

Set status checks to block coverage values on my pull requests

coverage:
  status:
    project:
      default:
        target: 80%    # the required coverage value
        threshold: 1%  # the leniency in hitting the target

Increase overall coverage on each pull request

Set blocking coverage targets so that each PR must increase coverage

coverage:
  status:
    project:
      default:
        target: auto  # auto compares coverage to the previous base commit

Ease target coverage

Relax my coverage target, because I have flaky tests

coverage:
  status:
    project:
      default:
        target: auto
        # adjust accordingly based on how flaky your tests are
        # this allows a 10% drop from the previous base commit coverage
        threshold: 10%

Ensure all code is covered

Set blocking coverage so that new code must be fully tested

coverage:
  status:
    patch:
      default:
        target: 100%

Set non-blocking status checks

See status checks but prevent them from blocking

coverage:
  status:
    project:
      default:
        informational: true
    patch:
      default:
        informational: true

Change the pull request comment

Change the format of the pull request comment

comment:
  layout: "reach, diff, flags, files"  # Remove items here to change the format

Only comment on coverage changes

  1. Show the comment only on coverage changes
comment:
  require_changes: true

See coverage on CI test failures

Show the Codecov status without waiting for other status checks to complete or pass

codecov:
  require_ci_to_pass: false

Send coverage notifications even if all CI statuses have not completed

Send notifications as soon as possible, even if the CI has not completed or a manual CI workflow step is required.

codecov:
  notify:
    wait_for_ci: false

Isolate my coverage

Isolate coverage based on the coverage report uploads

flags:
  projectA:
    paths: 
      - src/projectA/
  projectB:
    paths:
      - src/projectB/
  
# To see status checks based on flags
coverage:
  status:
    project:
      default:
        flags:
          - projectA
          - projectB
      projectA:
        flags:
          - projectA
      projectB:
        flags:
          - projectB

You will need to assign a flag to each coverage report uploaded. We strongly do not recommend using multiple flags on the same report. Instead, upload the report twice.

bash <(curl -s https://codecov.io/bash) -f coverage.xml -F projectA
bash <(curl -s https://codecov.io/bash) -f coverage.xml -F projectB

Disable pull request comments

Disable PR comments from Codecov

comment: false

Updated 4 months ago


Common Recipe List


A list of common tasks and configurations

Suggested Edits are limited on API Reference Pages

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