The branch coverage couldn't reach the 100%.
I found that the branch coverage could not reach 100% in the report. And it shows the IF ELSE reminder at the very first beginning, although there's no other branches in the current tested file. Please refer to the snapshots below.
I was wondering whether it's caused by importing the @sucrase/jest-plugin which replaced the original coverage provider.
Backstage release-2021-7-29.
Thanks, @fshowalter.
Poked around at the coverage of some of our tests, and I believe what's going on here is that sourcemaps for the coverage are working just fine. The stuff we're seeing at the top of the files are most likely helpers added by sucrase, which are just functions for handling things like optional chaining. We'll eventually be able to skip transpiling these, but it might be a while, but tbh I think it's the way forward.
I would assume that there actually is a lack of coverage though, although it might not always be the case. Do check if you for example can bump it up by covering some more cases in an optional chaining for example. It's obviously not optimal the way it works atm, but I'm also having a hard time figuring out what we can do instead other than waiting for transpilation to no longer be needed.
I'm assuming the close was by mistake 😅
Agree on both fronts. It's the helpers and optional chaining can be an example an issue. BUT, that's hardly apparent from the coverage output vs. ts-jest where it will highlight the optional chaining line and indicate it's partially covered. This is a tough one, and likely needs to be resolved between sucrase and istanbul.
@Rugvip , we just switch back to js-test to solve this coverage issue atm. But you're right, we should find the way to solve this problem fundamentally.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@SerenaIce found a more proper fix to this in #8173, switching the coverageProvider to 'v8' seems to yield much better results, especially for the branch coverage.