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
This one is tricky because the setTimeout global found in the npm packages is different than the setTimeout found in Deno code since Node's setTimeout is not web standard (it returns an object instead of a number). So, the sinon code is not overriding the Deno global setTimeout, but instead only the Node one. I don't think by design there is a solution here to make this work.
In the future, we will probably have the ability to import from node: specifiers, which means to make this work you would need to import setTimeout from Node like so:
// does not work at the moment, but may in the futureimport{setTimeout}from"node:timers";importsinonfrom'npm:sinon';constclock=sinon.useFakeTimers();setTimeout(()=>{console.log('setTimeout');},1_000_000);awaitclock.runAllAsync();
Node.js
Deno
Node result:
Displays setTimeout imediately.
Deno result:
Waits for 1 milion miliseconds then displays setTimeout
The text was updated successfully, but these errors were encountered: