initializeFakeTimer.ts 462 B

1234567891011
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { install, type InstalledClock } from '@sinonjs/fake-timers'
  3. const useFakeTimers = (config: { now: Date }) => {
  4. const clock = install(config) as InstalledClock & { restore(): void }
  5. clock.restore = clock.uninstall
  6. return clock
  7. }
  8. // support old-style sinon.useFakeTimers instead of overriding a method for mobile tests
  9. Reflect.set(globalThis, 'sinon', { useFakeTimers })