Skip to content

Is wrapping with act now required? #906

Answered by ph-fritsche
MattyBalaam asked this question in Q&A
Discussion options

You must be logged in to vote

No, wrapping with act is neither required nor recommended.

@testing-library/react manipulates the configuration of the underlying @testing-library/dom when you import it.
@testing-library/user-event uses that configuration.

If await user.anyAPI() yields an act warning and user.anyAPI(); await waitFor() does not, they might not use the same configuration i.e. not the same copy of @testing-library/dom.

If you use one of the framework wrappers, it is important that @testing-library/dom is resolved to the same installation required by the framework wrapper of your choice.
Usually this means that if you use one of the framework wrappers, you should not add @testing-library/dom to your project…

Replies: 7 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ph-fritsche
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@gdostie
Comment options

@hyalen
Comment options

@srosato
Comment options

@gdostie
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
8 participants