-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
[tests] fix hidden use() warnings #31984
[tests] fix hidden use() warnings #31984
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -561,6 +577,7 @@ describe('ReactUse', () => { | |||
'triggered by `use`, wrap your component in a error boundary.', | |||
); | |||
} | |||
console.error.mockRestore(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't restore the mock at the end of a test using spyOnDev
, all tests after it will have the console errors silenced and break the toErrorDev
/ assertConsoleErrorDev
tests.
This quick fix isn't the best either because if this test fails, the mock won't restore so test after it will fail even though they pass. The best would be to restore in an afterEach
in setupTests.js
, but that will fail a bunch of tests so I'll follow up with that.
Comparing: 03e4ec2...247b671 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
83dec33
to
e4e412b
Compare
11db179
to
f67863c
Compare
spyOnDev
is such a footgun.