-
Notifications
You must be signed in to change notification settings - Fork 367
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
refactor: [M3-7800] - Clean up new QueryClient()
pattern in unit tests
#10217
refactor: [M3-7800] - Clean up new QueryClient()
pattern in unit tests
#10217
Conversation
Coverage Report: ❌ |
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.
This is great cleanup, looks good with all unit tests passing. Approved pending conflicts.
setLogger({ | ||
log: () => {}, | ||
warn: () => {}, | ||
error: () => {}, | ||
}); |
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.
What is this?
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 think it was a way to hide some console warning/errors, but I don't think we need to do it anymore. I don't see any React Query specific errors in our test logs
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.
Wholesome, thank you!
Description 📝
new QueryClient()
instances 🧹new QueryClient()
in our unit test because we were having issues with unit tests sharing the same React QueryQueryClient
and cache. It was causing flakiness. Today,wrapWithTheme
create a newQueryClient
each time it is called and Vitest ensures each test runs in isolation. We shouldn't need to donew QueryClient()
in our unit test because they are isolated by default 📙How to test 🧪
Verification steps
yarn test
locally 💻As an Author I have considered 🤔