gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 786 forks source link

No function coverage for named exports in barrel file #959

Open superdyzio opened 9 months ago

superdyzio commented 9 months ago

Hello! I have a Nx project with Angular, one app, multiple libs, each of them has barrel file with exports - index.ts.

Some exports in those file goes like that export * from 'whatever', but there are also multiple named like export { Something } from 'whatever'. I have perfect coverage report for all of them but one.

In one of my libs, main barrel file of the lib gets 100% of statement coverage, but 0% of coverage in terms of functions on all my named exports. I cannot figure out why coverage works for named exports in other barrel files but in this particular one.

I made sure that things exported in uncovered lines are used in multiple places of both given lib and in app, they are also used in tests in both lib and app - all of these tests pass and have proper coverage.

Screen of coverage report (you can notice "8x" in terms of lines and red marking in terms of functions): image

My env: Angular@15.2.9 nx@15.9.0 jest@29.4.3 nrwl/jest@15.9.0 node@18.12.0

Anyone knows how to fix it?