Closed jakebailey closed 4 months ago
Yeah, it seems to be related to that unreached return. Another example:
Actually for an easier repro, just clone https://github.com/microsoft/TypeScript/pull/58850 and do npm test -- --no-lint --coverage
.
Hopefully this isn't inherent to v8 profiling in general :((
It seems like this problem occurs when there is a function
defined after a return
statement.
It doesn't seem very reasonable, but there's no syntax error. I will figure out how to fix it. thanks for the case.
This is super common code in our codebase as we don't use classes, but instead return plain objects of closures for performance.
Built with your most recent change; it does fix some of it, but not all.
This bit works:
However, just a bit lower, there are still lines that are mis-marked:
I haven't checked all the lines, but it seems like it has been fixed.
@jakebailey Could you please try monocart-coverage-reports@2.8.4
Seems like it's working! Thank you!
Describe the bug A clear and concise description of what the bug is.
To Reproduce
npx c8 --experimental-monocart --reporter=v8 npm test -- --no-lint
npx serve coverage
Expected behavior A clear and concise description of what you expected to happen.
Code for hoisted but called functions should be marked as covered.
Errors or Screenshots Any captured error messages, or add screenshots to help explain your problem.
This code is marked as uncovered in red, but at the same time has the little green boxes showing that it really did execute.
Probably, this has something to do with how these functions are declared after the return but the return is never reached.
Make a minimal reproduction
Sorry, I don't know if I can make a small reproducer; I tried writing similar code like:
But it didn't exhibit the same problem.
Additional context Add any other context about the problem here.