warnings
The state update lands after your await resolves
Every form library validates asynchronously, so the update arrives after
await userEvent.type(...) returns — hence "not wrapped in act(...)"
[12].
react-hook-form's ⭐ 45k own answer: validation is always async, so
await a UI consequence with find*/waitFor, and do
not wrap render() in act()
[4].
Adding your own act() around user.* is the wrong fix — user-event
already wraps them, and double-wrapping produces the contradictory "environment is not
configured to support act" warning
[13].
Corollary: an assertion-free interaction is a warning generator. If a
mode: 'onChange' form validates on first keystroke and the test ends there,
the update escapes the act scope. Assert on something.
// ✗ warns: nothing awaits the resolver's async validation await user.type(screen.getByLabelText('Email'), 'bad') expect(screen.getByText('Invalid email')).toBeInTheDocument() // ✓ awaits the consequence; no act() anywhere await user.type(screen.getByLabelText('Email'), 'bad') expect(await screen.findByText('Invalid email')).toBeInTheDocument()
Slickensides — the polish left where two blocks ground past one another. Evidence of the slip, long after it happened.