Skip to content

Conversation

@michaldudak
Copy link
Member

@michaldudak michaldudak commented Jul 3, 2024

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.

@michaldudak michaldudak changed the title Test utils update [test] Update test-utils and remove enzyme Jul 3, 2024
@mui-bot
Copy link

mui-bot commented Jul 3, 2024

Netlify deploy preview

https://deploy-preview-473--base-ui.netlify.app/

Generated by 🚫 dangerJS against 8e33a6e

@michaldudak michaldudak force-pushed the test-utils-update branch 2 times, most recently from e084eb7 to 3cd803c Compare July 3, 2024 09:38
@michaldudak michaldudak marked this pull request as ready for review July 3, 2024 09:53
@michaldudak michaldudak merged commit 3b777c8 into mui:master Jul 5, 2024
@michaldudak michaldudak deleted the test-utils-update branch July 5, 2024 06:01
const render = async (element: React.ReactElement, options?: RenderOptions) =>
act(async () => {
const result = await originalRender(element, options);
await flushMicrotasks();
Copy link
Member

@oliviertassinari oliviertassinari Oct 2, 2024

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?

Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants