Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

vytautassvirskas
Copy link

close #8738

@fzaninotto
Copy link
Member

A unit test fails...

@vytautassvirskas vytautassvirskas marked this pull request as draft February 17, 2025 18:56
@vytautassvirskas vytautassvirskas marked this pull request as ready for review February 17, 2025 18:57
@fzaninotto
Copy link
Member

Any updates?

@vytautassvirskas
Copy link
Author

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';
Copy link
Contributor

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)?

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for disabling error logging
3 participants