You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See also #34, #325. I ended up converting my entire codebase to explicitly pass in dependencies I wanted to mock and giving up on things like rewire, esmock for this reason; they just don't work with c8.
Libraries:
There seems to be a problem with the code coverage reported by c8 when the module under test is imported using rewire.
Rewire wraps the module with setters and getters so that private variables and functions can be stubbed.
I'm using AVA as the test runner.
My test file have no tests, I'm only importing AVA, rewire and my module:
Invoking
c8 ava
yields 100% coverage on the module.If I simply
require()
the module instead, I get 10% or so (which is expected since the module does some initialization).Swapping
c8
bynyc
yields the expected 10% coverage when using rewire, so it seems the instrumentation inside rewire messes up c8's.I struggled to find anything related to this incompatibility. Are there any other reports on this issue?
The text was updated successfully, but these errors were encountered: