# Incorrect repots merging

**URL:** <https://community.codecov.com/t/incorrect-repots-merging/3535>\
**Category:** Bug Fixes\
**Tags:** javascript, github\
**Created:** [March 9, 2022, 5:27pm UTC](https://community.codecov.com/t/incorrect-repots-merging/3535 "2022-03-09T17:27:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul-thebaud](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/paul-thebaud/32/2355_2.png) [@paul-thebaud](https://community.codecov.com/u/paul-thebaud)\
**Post date:** [March 9, 2022, 5:27pm UTC](https://community.codecov.com/t/incorrect-repots-merging/3535/1 "2022-03-09T17:27:00Z")

</div>

### Description

In my project, I use Cypress and Jest to run E2E and unit tests suites.  
I have a Github workflows to run those tests and the two coverage are uploaded to codecov by the action.

When I look at Codecov report on the app, some lines are reported as uncovered (example: [VPhoneInput.vue line 497](https://app.codecov.io/gh/paul-thebaud/v-phone-input/blob/c18a7ca27c65a6845ca75a44d57d3a0ebf7c06b9/src/components/VPhoneInput.vue).

When I download the uploaded coverage from [my CI execution](https://github.com/paul-thebaud/v-phone-input/actions/runs/1958578185) and check the unit test report for the same file and line, there are hits for the statement.

### Expected Results

The line should be marked as covered by codecov too.

### Actual Results

It is not covered in the codecov report.

### Additional Information

Before using codecov, I was having similar problems with NYC report merging tools. This is probably due to the Codecov report merging tools.

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [March 10, 2022, 10:38pm UTC](https://community.codecov.com/t/incorrect-repots-merging/3535/2 "2022-03-10T22:38:53Z")

</div>

@paul-thebaud, this is actually coming from your e2e tests.

I forked the repo and uploaded just the `unit` tests, and you can see coverage for [VPhoneInput.vue line 497](https://app.codecov.io/gh/thomasrockhu-codecov/v-phone-input/blob/main/src/components/VPhoneInput.vue) is not touched.

However, when I only upload `e2e` tests, you see that [line 497](https://app.codecov.io/gh/thomasrockhu-codecov/v-phone-input/blob/465826bfea6ded1a7a2d1c9ed264fa58735d8791/src/components/VPhoneInput.vue) is showing as not covered.

If you dig into the [coverage report](https://codecov.io/gh/thomasrockhu-codecov/v-phone-input/commit/465826bfea6ded1a7a2d1c9ed264fa58735d8791/build), you’ll see that file `path=coverage-e2e/coverage-final.json`, shows two bits of information that is useful.

1. The coverage report notes the lines starting at 497 as a branch (as it is in this ternary)  
 ![image](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/d/df351f434c30c4b130726f3ca33e908ed5d964f4.png)
2. That branch (`0`) is never run  
 ![image](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/6/66cc733150020186d8e80444e171cd75783b599e.png)

---

<div class="post-metadata">

**Author:** ![paul-thebaud](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/paul-thebaud/32/2355_2.png) [@paul-thebaud](https://community.codecov.com/u/paul-thebaud)\
**Post date:** [March 12, 2022, 11:14pm UTC](https://community.codecov.com/t/incorrect-repots-merging/3535/3 "2022-03-12T23:14:04Z")

</div>

Hi @tom, thanks for the quick reply.

I don’t understand. How could a map callback could be touched without touching the map call itself?  
And since some lines are covered by one part of tests (eg. E2E), why is this not getting merged with other to get a full cover?

Thanks for your time.

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [March 14, 2022, 5:52pm UTC](https://community.codecov.com/t/incorrect-repots-merging/3535/4 "2022-03-14T17:52:49Z")

</div>

> [@paul-thebaud](#):
>
> How could a map callback could be touched without touching the map call itself?

I’m not sure because I’m not familiar enough with how `cypress` collects coverage. What happens if you run e2e tests only and spit out the HTML file as described [here](https://docs.cypress.io/guides/tooling/code-coverage#Code-coverage-as-a-guide)? I suspect you will see line 497 being uncovered.

> [@paul-thebaud](#):
>
> And since some lines are covered by one part of tests (eg. E2E), why is this not getting merged with other to get a full cover?

I’m not sure I understand the question here. Line 497 does not have coverage information from unit tests, only E2E. So on the merge, we would take the result from E2E.

---

<div class="post-metadata">

**Author:** ![paul-thebaud](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/paul-thebaud/32/2355_2.png) [@paul-thebaud](https://community.codecov.com/u/paul-thebaud)\
**Post date:** [March 15, 2022, 10:49am UTC](https://community.codecov.com/t/incorrect-repots-merging/3535/5 "2022-03-15T10:49:27Z")

</div>

Hi @tom,

Ok, I think I understand the problem: it looks like Jest won’t manage `map`, `filter`, etc. as branch where Cypress does. This will result in incorrect coverage because my unit tests covers only the `filter` part where E2E covers only the other part (see the attached screen captures).

This does no seems to be related to Codecov, so I’m closing the issue and will try to improve the coverage with this difference in mind!

Thanks again for your help.

Codecov capture

 ![codecov](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/f/ffdc7e2a63e4dbac2f950a8ebcd25175a77d7b93.png)

E2E with Cypress capture

 ![e2e-only](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/4/474226982ee2b936f3aad9be6f88e2e333d927bf.png)

Unit with Jest capture

 ![unit-only](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/f/f949c19d41b2be0c87d37603ab887c7e63a82e86.png)
