Test with useButton gives me the famous "act" warning #2743
-
Hi, i'm using react-aria and react testing-library.
That is showing the following warning:
If I wrap the click with act the warning is gone, but seems it's not a good practice to do that, because, in fact, testing library is doing an act internally in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
That test works for us Would you mind trying what we do in triggerPress? (we need to update that now that userEvent has had some releases that cover the problems we used to have with it) https://github.com/adobe/react-spectrum/blob/main/packages/dev/test-utils/src/events.ts#L19 You could try some other versions of userEvent as well. |
Beta Was this translation helpful? Give feedback.
That test works for us
react-spectrum/packages/@react-spectrum/button/test/Button.test.js
Line 34 in c838181
Would you mind trying what we do in triggerPress? (we need to update that now that userEvent has had some releases that cover the problems we used to have with it)
https://github.com/adobe/react-spectrum/blob/main/packages/dev/test-utils/src/events.ts#L19
You could try some other versions of userEvent as well.