Warning: An update to Component inside a test was not wrapped in act(...)
A component updated state after the test’s synchronous assertions — async work wasn’t awaited.
Seen on:
React
Meaning
Testing Library wraps render and events in act, but async effects (fetches, timers) resolve later. Await the UI changes with findBy*/waitFor.
Common causes
- Assertions before async data loads
- Unawaited timers or promises
- Tests ending while effects still run
⚡ Quick fix
- Use await screen.findByText(...) or await waitFor(...)
- Use fake timers and advance them inside act
- Mock async dependencies
Detailed fix by platform
React
expect(await screen.findByText('Loaded')).toBeInTheDocument();
How to diagnose
- Update — Which async work triggers it?
- Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026