-
Notifications
You must be signed in to change notification settings - Fork 153
Closed as not planned
Labels
enhancementNew feature or requestNew feature or requesttriagePending to be triaged by a maintainerPending to be triaged by a maintainer
Description
What rule do you want to change?
no-unnecessary-act
Does this change cause the rule to produce more or fewer warnings?
More warnings
How will the change be implemented?
check if no-unnecessary-act rule applies correctly to the new act of react
Example code
Since the latest react release it seems to be necessary to wrap state changes with the new act of react:
When testing, code that causes React state updates should be wrapped into act(...):
act(() => {
/* fire events that update state */
});
/* assert on the output */
Implementation:
import { act } from 'react'
await act(async () => {
await userEvent.click(radioButton)
})
How does the current rule affect the code?
This is wrongful (?!) picked up by testing-library/no-unnecessary-act
How will the new rule affect the code?
if possible, consider act coming from react could be ignored
Anything else?
No response
Do you want to submit a pull request to change the rule?
No
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesttriagePending to be triaged by a maintainerPending to be triaged by a maintainer