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] Fix tests failing on subsequent runs in watchmode #18076

Merged
merged 3 commits into from
Oct 29, 2019

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Oct 28, 2019

Use custom createServerRender instead of test-utils/createRender (which is now deprecated). This allows custom cleanup logic to handle useLayoutEffect warnings when using ssr API in a DOM environment. Mocking the React module seems to be lost on repeated runs in watchmode (which was the bulk of the failures).

Other issue were due to incomplete cleanup (window.matchMedia stubs) or excessive polling of ByRole in wait (which we should probably remove but let's wait a bit; edit: only now realized that this was a great pun).

I have a feeling that there's something leaking when watching. This might explain why some tests only timed out on subsequent runs.

@eps1lon eps1lon added the test label Oct 28, 2019
@mui-pr-bot
Copy link

mui-pr-bot commented Oct 28, 2019

No bundle size changes comparing 9a39b3c...7469dd4

Generated by 🚫 dangerJS against 7469dd4

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix tests failing on subsequent runs in watchmode

Oh yeah! This sounds like we will have better test isolation. I have frequently experienced that a failing test can break all the following ones. This forced us to restart the watch process.

const { getByTestId, getAllByRole, getByRole, queryByRole } = render(<SelectAndDialog />);
expect(getByRole('button')).to.have.text('Ten');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we share the same variable?

Suggested change
expect(getByRole('button')).to.have.text('Ten');
expect(trigger).to.have.text('Ten');

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That isn't supposed to be there anyway.

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.

3 participants