-
Notifications
You must be signed in to change notification settings - Fork 20
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
Calling jest.resetAllMocks() disables the check #10
Comments
Thanks for reporting this issue. This might have been added by #5 , could you please try with Regarding using |
@ValentinH Sorry for the slow turnaround. I have some updates...
I created a repo that tests both versions |
Thanks for the details answer. I think we could partially revert what has been changed in #5. If I understand correctly this PR did 2 things:
if we only revert the second one, meaning setting the custom logic "manually", it should fix this issue while still fixing the original issue of #5. What do you think ? |
My jest setup looks llike this: beforeEach(() => { failOnConsole();` |
@ValentinH Yes, I agree... if we just get rid of the spy usage it should be ok. While appreciating the author's intentions to use the native spy functionality, it could lead to unexpected conflicts (as it did for me). Do you need help with this? |
No it's ok, I'll do it. I just need to get back my admin access. I'll probably have it this week. |
The fix was published in v2.2.1 |
Awesome sauce! I’ll integrate and give it a try tomorrow!
|
Worked like a charm. Thanks! |
A pattern common in my tests is to call
jest.resetAllMocks()
in abeforeEach
block to help ensure that tests are truly independent and don't depend on any state from other tests.I found that this disables the magic from this package. This seems obvious looking at the source since it depends on jest spyOn mocks.
To re-enable the magic, I found that I can call
failOnConsole()
after anybeforeEach
block that calledjest.resetAllMocks()
.The text was updated successfully, but these errors were encountered: