New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react-test-renderer doesn't support Suspense and lazy nodes #14170
Comments
Getting something similar with Enzyme. |
Hi @gaearon , sorry for pinging here. In enzymejs/enzyme#1975 we are also stuck with that the shallow renderer doesn't support rendering Suspense. |
I suspect that until Buzz (or was it Fizz?) is ready, you'll have to do with just rendering the fallback. The current server renderer is synchronous. |
Shallow render is different with server renderer I think. I'm just wondering how we can support Suspense in shallow renderer. |
Hi, I'm wondering if there is any decision made regarding how |
Just ran into this as well. Assuming this still isn't supported? The promise never resolves and the suspense state always renders the fallback. |
|
One workaround that I used that seems to work at least on my local machine is to await a setTimeout 0 promise after the render but before the expect statements. This gives a tick between the render and the expect to load and render the lazy component.
This cannot be used in cases where timers are mocked since it relies on a timer to operate. |
@patrickmcdougle-okta wow, this actually worked. Thank you! |
Hello. How can I test components with Suspense/Lazy?
now renderer.create(...)toTree() throws
"toTree() does not yet know how to handle nodes with tag=13"
react 16.6.1
react-test-renderer 16.6.1
The text was updated successfully, but these errors were encountered: