sindresorhus / p-retry

Retry a promise-returning or async function
MIT License
798 stars 66 forks source link

Use with sinon fake timers #49

Open Bilb opened 3 years ago

Bilb commented 3 years ago

Hi, I would like to know how can I fake the minTimeout of my r-retried function using sinon.fakeTimers or anything equivalent ? Thanks

papb commented 3 years ago

I'd guess sinon.useFakeTimers() should just work for what you want, since p-retry uses retry which reads setTimeout and clearTimeout directly from the global scope.

I had the opposite problem recently, read here to know more

Good luck!