-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Branch coverage is wrong for angular projects with Jest #818
Comments
@danil-z coverage are wrong due to outdated angular preset. I have since a long time some WIP on the angular preset to make it compatible with latest version of ts-jest, but I had to leave it by side as I'm really busy on other projects. Anyway, it's ok to keep this issue open for others to know, but issue is actually angular preset that needs to be updated to make it compatible with ts-jest >= 23.10. There might already be an issue there tho. |
If you could explain it little bit more, or what exactly is required I'd submit them PR |
I've tried to update dependency on ts-jest
but still experiencing same coverage bug |
here is open ticket about supporting ts-jest >= 23.10 in angular preset |
@danil-z FYI I've posted there little explain and link to WIP PR with my local work so far |
FYI - There has been an issue about this on istanbul for almost 2 years. There is also a matching issue on jest, and jasmine, and everything else that depends on it. So, it's not very likely this will be resolved any time soon. Seeing my 50% branch coverage makes me cry myself to sleep at night. Welcome to the party. :-( |
fixed in |
@ahnpnl Do you know what was the exact fix? I am asking because I am still seeing the issue with coverage for dependency injection. |
Hi, the fix in ts-jest starting from 23.10 that ts-jest uses AST transformer + TS compiler internally via isolatedModules config option to fix that coverage issue. |
Last time I checked the coverage is correct if leaving isolatedModules with false value (default), true value will make the issue appear again. |
@ahnpnl indeed, setting
And still counting ... Is there a chance to make coverage work properly with If I do |
Still actual issue :( |
Same here when using Unfortunately 😓 |
Issue :
Branch coverage is wrong , seems ts-jest transpiles injectables with some sort of branching and differs from tsc
related issues:
Expected behavior :
100% coverage
Minimal repo :
Following repo generated with angular cli, added 1 simple button with router action and test for it.
It reports uncovered branch in constructor with injectable Router service.
https://github.com/danil-z/covjest
The text was updated successfully, but these errors were encountered: