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

[test] Update test-utils and remove enzyme #473

Merged
merged 5 commits into from
Jul 5, 2024

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
18 checks passed
@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