Unexpected drop in project coverage for Pull Request

Modified on Wed, 28 Sep 2022 at 01:17 PM


Patch coverage passes but the project coverage drops.


This discrepancy might be caused if you have removed covered lines from your project. This can cause the ratio between covered lines and total lines of codes to decrease.


Here's an example:

You have 20 covered lines in a file with 60 code lines. Therefore, this file is 30% covered.

Let's say you refactor and remove 10 covered lines. You now have 10 covered lines, out of 50 possible code lines. Your file coverage is now 1/5, instead of 1/3.


You can determine if this is happening by:

  • Downloading the raw reports from the build tab on Codecov for the head and base of your pull request;

  • Checking if the total number of covered lines has dropped between the reported files.

If this is the case, you can add an acceptable margin of change to the target percentage for the project status by setting the threshold value for the status check in your codecov.yml file. See more details about this here: Status Checks 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article