-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
[test] Update test-utils and remove enzyme #473
Conversation
143d2cd
to
9a7fd57
Compare
Netlify deploy preview |
e084eb7
to
3cd803c
Compare
3cd803c
to
d3be7d7
Compare
d3be7d7
to
070b3ed
Compare
const render = async (element: React.ReactElement, options?: RenderOptions) => | ||
act(async () => { | ||
const result = await originalRender(element, options); | ||
await flushMicrotasks(); |
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 looks strange. Why does Base UI needs those await when the other repositories don't?
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.
Most of our components rely on Floating UI, which requires this pattern for testing in some cases. I figured it's better to always wait for pending promises instead of deciding on test-by-test basis (which also makes the test more close to what users perceive).
Used the latest internal-test-utils (mui/material-ui#42771) with the fixed
flushMicrotasks
function.Fixed a few tests that were failing after this change.
Ported mui/material-ui#42706 to our repo, removing Enzyme completely.