-
Notifications
You must be signed in to change notification settings - Fork 107
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
runAllAsync and runToLastAsync do not run code in the microtask queue #483
Comments
Jest can do it because it transpiles (probably) We can't do it because queueMicrotask isn't hookable from JS like nextTick, we can use an internal Node API but without connecting a debugger it'd be hard to write it in a stable way |
@benjamingr Could you elaborate on this a bit? I am not sure I understand at all. We do take control over I see the
I am not quite sure why that second job is there, but you say there is something about the async versions we cannot control? |
I made a go and I think I found the bug, unless I am missing something substantial. This little diff should be sufficient to get the @@ -1578,6 +1578,8 @@ function withGlobal(_global) {
function doRun() {
originalSetTimeout(function () {
try {
+ runJobs(clock);
+
let numTimers;
if (i < clock.loopLimit) {
if (!clock.timers) { I cannot claim that I understand all the minute details of fake-timers, but I did see that I still see that the |
Fix in #485. I'll move the tests into the right places if I got it right 😄 |
* Add test from jestjs/jest#14549 * Fix for *Async time forwarders
Closed by ^ |
runAllTimers
/runOnlyPendingTimers
don't run code in the microtask queue jestjs/jest#14549What did you expect to happen?
I expected that fake timers
What actually happens
They do not.
How to reproduce
See https://github.com/fatso83/lolex/blob/async-issues-run-all/test/issue-async.test.js
The text was updated successfully, but these errors were encountered: