You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following test case is failing on 19.0.2 on node 6.9.6, 7.50, and 7.7.1
it("only runs currently scheduled tasks [immediate]",function(){jest.useFakeTimers();letc1=false,c2=false;setImmediate(()=>{c1=true;setTimeout(()=>c2=true,100*1000);});expect(c1).toBe(false);expect(c2).toBe(false);jest.runOnlyPendingTimers();expect(c1).toBe(true);expect(c2).toBe(false);// <--------- this check fails});
I'm not sure whether the setImmediate should be run by runOnlyPendingTimers or not (the docs say it runs "macro-tasks"), but the inner timeout should definitely not be run.
As a point of comparison, the following test passes:
it("only runs currently scheduled tasks [timeout]",function(){jest.useFakeTimers();letc1=false,c2=false;setTimeout(()=>{// <----- changed this linec1=true;setTimeout(()=>c2=true,100*1000);});expect(c1).toBe(false);expect(c2).toBe(false);jest.runOnlyPendingTimers();expect(c1).toBe(true);expect(c2).toBe(false);});
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
The following test case is failing on
19.0.2
on node 6.9.6, 7.50, and 7.7.1I'm not sure whether the
setImmediate
should be run byrunOnlyPendingTimers
or not (the docs say it runs "macro-tasks"), but the inner timeout should definitely not be run.As a point of comparison, the following test passes:
You can see this live at https://repl.it/GFHY/2
The text was updated successfully, but these errors were encountered: