Codecov/patch strange behavior

Before submitting a topic, please confirm the following

I have searched for similar issues before creating this topic.
I have verified that my repository is using the Codecov GitHub app, if using GitHub
I have validated my codecov.yaml configuration file.
I have filled out the below sections to the best of my ability.
I understand that the community boards are a free, best-effort tool. While we hope to have someone on the Codecov team resolve your problem quickly, this is not always possible.

Description

Description of the issue
In a PR codecov/patch tells that I have a reduction in amount of tests even after I added a test.
This is link to the PR

CI/CD URL

Please provide a link to the CI/CD run.

Codecov Output

Please provide the full output of running the uploader on your CI/CD. This will typically have the Codecov logo as ASCII.

Expected Results

Please provide what you expect to have happened (e.g. a file that has missing coverage on a particular line).
Increase in the % of coverage

Actual Results

Please provide what actually happened.
Reduction in the % of coverage

Additional Information

Please provide applicable commit SHAs or file names that are extraneous or missing. Any additional information, configuration, or data that might be necessary to reproduce the issue.

@Fewwy, to be clear, patch coverage

only measures lines adjusted in the pull request or single commit, if the commit is not in a pull request. This status provides an indication on how well the pull request is tested.

In other words, it measures the coverage of newly added code.

If you go back to the PR, you’ll notice where Codecov sees new lines of code, but no corresponding tests has been added. Take lines 1-5 and 7-9 below.


If you are talking about project coverage which measures the coverage over the entire codebase, you can see that you have added new lines of code that are not covered by tests.

Compare your BASE commit which shows

146 lines covered/2179 total lines
versus your HEAD commit


146 lines covered/2187 total lines

This is why project coverage drops.


You mentioned you wrote tests. I would make sure that the test is running and coverage is being collected for them since Codecov is not getting results for it.

Thanks for your reply Tom,
It seems that it’s either our upload script broke or we have issues with the config.

Could you take a look at our config maybe you would see errors in it?

coverage:
  status:
    patch:
      default:
        # basic
        target: auto
        threshold: 0%
        base: auto
        # advanced
        branches:
          - master
        if_ci_failed: error #set the status to success only if the CI is successful
        only_pulls: false #Only post a status to pull requests
        flags:
          - "unit"
    project:
      default:
        # basic
        target: 0%
        threshold: 10%
        patch: false
        flags:
          - unit
       # advanced settings
        branches:
          - master
        if_ci_failed: error #success, failure, error, ignore
        informational: false
        only_pulls: false

@tom Hello Tom! If you have some spare time - please check the config I linked, because I want to fix issues with our repo

@Fewwy hmm, I would suggest not making target: auto for patch. That means that every commit should have equal or greater patch coverage which doesn’t always make sense. I would set that to a real number.

To your initial point, your PR has a passing check now.