Skip to content

v5.5.1 introduces act-type warning in tests #111

@curtvict

Description

@curtvict

Hey! I just wanted to respectfully point out that the v5.5.1 patch might have actually brought along a breaking change, depending on your definition of "breaking change" ;)

We use Mind Renovate to manage our package upgrades automatically. We also use jest-fail-on-console to help keep on top of both, what I call, our "test barf" and to help us be a bit more careful about what non-critical warnings and errors might be raised and subsequently ignored by us during development.

Anyway, when Renovate tried to upgrade to react-select-event to v5.5.1 we started getting a failing build on that branch due to a new act-style warning being thrown... you know the one:

    Warning: An update to WhateverComponentLol inside a test was not wrapped in act(...).

    When testing, code that causes React state updates should be wrapped into act(...):

    act(() => {
      /* fire events that update state */
    });
    /* assert on the output */

... snip ...

I just wanted to point this out because it was unexpected in a patch release and the removal of the act call seems like the entire reason why this patch was released in the first place.

We're on react 17.0.2 and @testing-library/react 12.1.5 for what it's worth which seems to meet this project's devDependencies requirements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions