Open tyler-dane opened 11 months ago
After investigating, I am the problem. The warnings are indeed valid. They're pointing out that many effects are going on that make it hard to be certain the tests aren't being affected. These effects are mostly related to dragging, resizing, and drag-and-dropping events.
Instead of updating RTL's config, the solution is to isolate our effects so tests can be more isolated. That's gonna take a lot of refactoring that isn't a top priority now.
So, wrapping tests in act()
is acceptable for the time being.
After effects are better isolated from presentation, we can gradually remove them.
Prerequisites
Expected Behavior
React Testing Library tests run without any warnings
Current Behavior
act()
warnings appear during tests, even when tests pass.Steps to Reproduce
Setup your dev environment. Follow the Setup Guide up to the Start in Dev Mode section
Run a single React Testing Library:
or yarn test:web to run all the web-related tests
Possible Solution (Not obligatory)
Context
Avoid the workaround of wrapping parts of the test in
act()
. This makes the test much harder to read, maintain, and debug. It's also a worse developer experience than the verbose logs.I have a feeling the solution will be related to updating RTL dependencies or configs. I'd like to avoid any scenario where Compass's RTL individual tests have to be modified.
Here are some relevant links about this issue: