Skip to content

Using TestRenderer.act() should not silence the ReactDOM warning #15319

Closed
@gaearon

Description

ReactTestRenderer.act() only works for react-test-renderer.
ReactTestUtils.act() only works for react-dom.

Unfortunately due to poor naming, people confuse those two things.

We need to:

  • Make sure ReactTestRenderer.act() around react-dom updates doesn't silence the warning, and vice versa. (Currently, it does — but you can fix it by using an empty object that's unique per renderer instead of a true value.)

  • Add a special warning message when a different renderer is "acting" updates. That warning message should suggest that you're supposed to use act() corresponding to the renderer you're using, e.g. react-dom/test-utils for react-dom.

This should fix most cases where people wrap updates in the wrong act.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions