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

Flags

Group coverage reports based on type of tests or system.

Codecov presents Coverage Flags, which is an uploading strategy to isolate coverage reports.

Usage

Toggle flags in the source code overlay

**Source code overlay** Toggle `unittests`, `integration` and `ui` coverage reports with one tap.

Source code overlay Toggle unittests, integration and ui coverage reports with one tap.

Filter flags in tree navigation (coming soon)

**Navigate** with specific flags visible.

Navigate with specific flags visible.

Flag badges and graphs

Badges and graphs may express specific flags only. More details on this will come soon.

Create custom notifications

You can specify Flags in your Codecov Yaml for statuses and all notifications.

coverage:
  status:
    project:
      default: off
      frontend:
        flags: frontend
      backend:
        target: 50%
        flags: backend
      api:
        target: 89%
        flags: api

flags:
  # filter the folder(s) you wish to measure by that flag
  backend:
    # only include files in the backend folder
    paths:
      - app/backend/
  backend:
    paths:
      - app/frontent/
  api:
    paths:
      - app/api/
  tests:
    paths:
      - tests/
**Custom Statuses** only report on specific Flags.

Custom Statuses only report on specific Flags.

How to create Flags

To apply a flag simply submit coverage reports with the -F flagname included in the upload command; Codecov will do the rest. The following example illustrates how you may run specific test groups and upload coverage, flagging each coverage group.

# example running unittests only
py.test --cov=./ -k tests/unittests/
bash <(curl -s https://codecov.io/bash) -c -F unittests

# example running integration tests only
py.test --cov=./ -k tests/integration/
bash <(curl -s https://codecov.io/bash) -c -F integration

# example running ui tests only
npm test
bash <(curl -s https://codecov.io/bash) -c -F ui

-c will remove all previously uploaded reports.

Remove old reports after uploading (optional)

Apply the -c argument to clear the workspace of all coverage reports before running you next set of tests.

Flags must be lowercase, alphanumeric, and not exceed 45 characters

Only lowercase, alphanumeric values are accepted. ^[a-z0-9_]{1,45}$

Hiding builds (e.g. nightly builds)

Codecov provides a strategy to isolate specific builds from the master report while maintaining the report's integrity. When reports are not joined into the master report, they will be ignored for comparison, although they will remain accessible for source overlay, api, badges, and graphing.

A nightly build is an excellent example of this feature. What follows is a yaml configuration for a nightly build.

flags:
  nightly:
    joined: false

Now that we have configured the flag nightly to not join into the master report, let's upload a report flagged as nightly.

bash <(curl -s https://codecov.io/bash) -F nightly

By adding -F nightly we mark all the coverage report data for this build as nightly coverage data.

Flags

Group coverage reports based on type of tests or system.