-
Notifications
You must be signed in to change notification settings - Fork 55
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
DO NOT MERGE - rewrite test act helpers based on react/#15591 #266
Conversation
This simplifies your test helpers to loop until all timers are flushed (including the ones that get queued after updates), and works in concurrent mode. I also renamed actSuspense to actAsync to be clearer.
(I also wanted to rename |
Since facebook/react#15591 was merged and we're running on a canary release that includes it, I tried applying these changes in master. Looks like everything works except for react-devtools-experimental/src/__tests__/utils.js Lines 24 to 29 in 7aaef6f
Seems like the underlying cause are these bridge messages: react-devtools-experimental/src/devtools/views/Components/InspectedElementContext.js Lines 142 to 150 in c841101
Since the bridge batches things with a timeout: react-devtools-experimental/src/bridge.js Lines 48 to 51 in c841101
Not sure why they would cause problems specifically, given that other bridge messages don't cause other tests to fail. I've tried commenting out the |
Let's talk when we're both back in the office on Tuesday, Sunil. In the meanwhile I'll push my work in progress here https://github.com/bvaughn/react-devtools-experimental/pull/new/threepointone-act-async |
boop, have a look and let me know if this solves your problems |
sorry, I should be a commie about this |
Cool, thanks Sunil! |
Hey uh...looks like |
Oh hmm. We could just update to jest 24, if you could help resolve this issue with react-is? facebook/react#15778 |
(Alternately, there may be a way of getting at the timer count with a hidden api, I’ll have a look) |
Upgrading might be nice |
I'm pretty sure there's no way to access a count of scheduled timers in 23 without using a custom |
That doesn't sound out of the question, unless I'm misunderstanding something. It looks like the Not sure how to get a handle on that object though. |
Okay. I think that path would entail:
I'm able to inject, but I'm not seeing that function- maybe it was added in a later Jest v23 release. I'll try bumping that. |
Actually, tracing through the Jest source code- it looks like Jest sets |
Ah, I forgot about that. Removed in 24 and replaced by |
No problem 😄 Now I'm more familiar with Jest internals, having traced through this, so not wasted effort. |
Awesome! To answer your above question (even though they're striked out, so you probably figured it out), all your steps are correct. Should probably |
You rock. Thansk~ |
This needs facebook/react#15591 to land to work correctly.
This simplifies your test helpers to loop until all timers are flushed (including the ones that get queued after updates), and works in concurrent mode.