# Different results when using the node package compared to the bash script

**URL:** <https://community.codecov.com/t/different-results-when-using-the-node-package-compared-to-the-bash-script/2806>\
**Category:** Uncategorized\
**Created:** [April 23, 2021, 8:13am UTC](https://community.codecov.com/t/different-results-when-using-the-node-package-compared-to-the-bash-script/2806 "2021-04-23T08:13:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![julienwaj](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/julienwaj/32/1807_2.png) [@julienwaj](https://community.codecov.com/u/julienwaj)\
**Post date:** [April 23, 2021, 8:13am UTC](https://community.codecov.com/t/different-results-when-using-the-node-package-compared-to-the-bash-script/2806/1 "2021-04-23T08:13:57Z")

</div>

Hey,

Following the recent security issue with the bash uploader, I wanted to switch to using the node package instead of fetching+executing the bash script like before.  
And I was surprised that the result in codecov is notably different.

In our project we’re using jest with these options for the coverage system:

> <https://github.com/firefox-devtools/profiler/blob/be3a6378ef3eab3b8db1c5a8351f25b9a85e4330/package.json#L146-L150>

This looks pretty standard to me. As a result Jest generates 3 files:

- clover.xml
- coverage-final.json
- lcov.info
- lcov-report/ (directory)

That’s where I noticed a difference, when looking at the CI log:

- the bash script uploads all 3 `clover.xml``coverage-final.json``lcov.info`
- the node script seems to upload only `lcov.info` and `clover.xml`

Could that make a difference ? It’s not clear to me what different informations all these files are, until then I supposed they were containing the same information really.

Some more information:

- here is the PR switching to this node module: [https://github.com/firefox-devtools/profiler/pull/3281](https://github.com/firefox-devtools/profiler/pull/3281)
- This is the codecov report for this switch: [Codecov](https://app.codecov.io/gh/firefox-devtools/profiler/compare/3281) (I believe this is available without being logged in)

Codecov’s UI doesn’t make it any easier to analyze…  
For example, see this file: [Codecov](https://app.codecov.io/gh/firefox-devtools/profiler/compare/3281/tree/src/components/shared/PanelSearch.js)  
+10% as coverage, but the 2 lines that are shown are red as “not covered”; they were already not covered previously.  
But when looking closer:

- before: [Codecov](https://codecov.io/gh/firefox-devtools/profiler/src/be3a6378ef3eab3b8db1c5a8351f25b9a85e4330/src/components/shared/PanelSearch.js)
- after: [Codecov](https://codecov.io/gh/firefox-devtools/profiler/src/1d036c0680d83a837e480eeae6211e2c9cdb4437/src/components/shared/PanelSearch.js)

we see that 2 lines (42 and 43) were previously shown as “uncovered” and now they are just blank.

Another example is: [Codecov](https://app.codecov.io/gh/firefox-devtools/profiler/compare/3281/tree/src/components/shared/FilterNavigatorBar.js). Again the UI is quite bad… let’s look at the files directly:

- before: [Codecov](https://codecov.io/gh/firefox-devtools/profiler/src/be3a6378ef3eab3b8db1c5a8351f25b9a85e4330/src/components/shared/FilterNavigatorBar.js)
- after: [Codecov](https://codecov.io/gh/firefox-devtools/profiler/src/1d036c0680d83a837e480eeae6211e2c9cdb4437/src/components/shared/FilterNavigatorBar.js)

We clearly see a lot of the case disjunctions in the JSX code are missing in the new coverage.

I believe the “previous” information is correct in these 2 cases but haven’t looked at every cases.

All that to say that the behavior is different. Which might be OK 🙂 I guess I mostly need some guidance from you experts on how to get the same behavior as with the bash script. Happy to help with more data if needed!

Thanks!

---

<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:** [April 23, 2021, 7:36pm UTC](https://community.codecov.com/t/different-results-when-using-the-node-package-compared-to-the-bash-script/2806/2 "2021-04-23T19:36:41Z")

</div>

@julienwaj looks like we don’t search directly for `coverage-final.json` in the `node` uploader, but we do in [bash](https://github.com/codecov/codecov-bash/blob/master/codecov#L1308). I’ll make a PR and look to get it released next week.

---

<div class="post-metadata">

**Author:** ![julienwaj](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/julienwaj/32/1807_2.png) [@julienwaj](https://community.codecov.com/u/julienwaj)\
**Post date:** [April 26, 2021, 9:04am UTC](https://community.codecov.com/t/different-results-when-using-the-node-package-compared-to-the-bash-script/2806/3 "2021-04-26T09:04:13Z")

</div>

Thanks so much!

But is it expected that these various files give different information in the first place?

---

<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:** [April 27, 2021, 3:24pm UTC](https://community.codecov.com/t/different-results-when-using-the-node-package-compared-to-the-bash-script/2806/4 "2021-04-27T15:24:03Z")

</div>

@julienwaj I’ll be honest I’m not completely sure. Clearly it looks like there is a difference from our processing of the file, but I haven’t dug into the specifics of how `jest` creates coverage files to be able to answer authoritatively.

---

<div class="post-metadata">

**Author:** ![julienwaj](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/julienwaj/32/1807_2.png) [@julienwaj](https://community.codecov.com/u/julienwaj)\
**Post date:** [April 27, 2021, 4:06pm UTC](https://community.codecov.com/t/different-results-when-using-the-node-package-compared-to-the-bash-script/2806/5 "2021-04-27T16:06:36Z")

</div>

I think Jest just uses istanbul behind the scene nowadays.

---

<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:** [May 3, 2021, 6:23pm UTC](https://community.codecov.com/t/different-results-when-using-the-node-package-compared-to-the-bash-script/2806/6 "2021-05-03T18:23:51Z")

</div>

@julienwaj, I’ve updated the node uploader to `3.8.2`. Let me know if that works for you!

---

<div class="post-metadata">

**Author:** ![julienwaj](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/julienwaj/32/1807_2.png) [@julienwaj](https://community.codecov.com/u/julienwaj)\
**Post date:** [May 4, 2021, 10:06am UTC](https://community.codecov.com/t/different-results-when-using-the-node-package-compared-to-the-bash-script/2806/7 "2021-05-04T10:06:29Z")

</div>

Yeah this seems to work fine now 🙂 Thanks for the fix!

I’m still curious about the differences between all these files.

---

<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:** [May 4, 2021, 1:48pm UTC](https://community.codecov.com/t/different-results-when-using-the-node-package-compared-to-the-bash-script/2806/8 "2021-05-04T13:48:59Z")

</div>

@julienwaj one day I will do a deep dive into what the underpinning files are doing for these coverage tools. I will be sure to write it up and post it if that is helpful.
