Recently I updated from sinon 9 to sinon 14 which causes one of my tests to fail with the error Can't install fake timers twice on the same global object.. It looks like since version 12 it is not possible to call useFakeTimers multiple times to manage different clocks. What would be the alternative to achieve the same thing in sinon version 14?
t.test(`Skip calling the callback when the delay exceeds maxDelay`, t => {
t.plan(1);
const oneMinute = 60e3;
let rules = ['0 * * * * *']; // every minute
let timezone = null;
let maxDelay = 10;
let timerLag = 11;
let callback = spy();
let realClock = useFakeTimers({toFake: ['Date']});
let timerClock = useFakeTimers({ toFake: ['setTimeout', 'clearTimeout', 'setInterval', 'clearInterval', 'setImmediate', 'clearImmediate'] });
scheduleInterval(rules, timezone, maxDelay, callback);
realClock.tick(oneMinute + timerLag);
timerClock.tick(oneMinute);
t.equal(callback.callCount, 0);
realClock.restore();
timerClock.restore();
});