-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
Fix useDataProvider
should only log errors in development mode
#10515
base: master
Are you sure you want to change the base?
Fix useDataProvider
should only log errors in development mode
#10515
Conversation
A unit test fails... |
Any updates? |
hey, I was quite busy last week. I will update tests today |
@@ -229,7 +229,8 @@ describe('useDataProvider', () => { | |||
); | |||
}); | |||
|
|||
it('should call getList and show error', async () => { | |||
it('should call getList and show error in development environment', async () => { | |||
process.env.NODE_ENV = 'development'; |
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.
I'm afraid mutating process.env.NODE_ENV
like that will leak to other tests and break test independence. Can you mock the result using jest.mock
or jest.spy
instead (and call jest.restoreMocks
at the end)?
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.
hey 👋
I updated the tests in a slightly different manner than you suggested 🤞. If that's not suitable, I can implement the approach you recommended.
close #8738