Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Deprecation warning on act in tests #4685

Open
isqua opened this issue Oct 31, 2024 · 0 comments
Open

Deprecation warning on act in tests #4685

isqua opened this issue Oct 31, 2024 · 0 comments

Comments

@isqua
Copy link

isqua commented Oct 31, 2024

Image

act from react-dom/test-utils has been deprecated in favor of act from react.

react-dom/test-utils Deprecation Warnings – React

The signature '(callback: () => VoidOrUndefinedOnly): void' of 'act' is deprecated.ts(6387)
index.d.ts(388, 4): The declaration was marked as deprecated here.
(alias) act(callback: () => VoidOrUndefinedOnly): void (+1 overload)
import act
Wrap any code rendering and triggering updates to your components into act() calls.

Ensures that the behavior in your tests matches what happens in the browser more closely by executing pending useEffects before returning. This also reduces the amount of re-renders done.

@param callback — A synchronous, void callback that will execute as a single, complete React commit.

@see — https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks

@deprecated — https://react.dev/warnings/react-dom-test-utils

@isqua isqua changed the title Replace act from @testing-library/react with act from react in tests Deprecation warning on act in tests Oct 31, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant