modernFakeTimers.d.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. /// <reference types="node" />
  8. import { StackTraceConfig } from 'jest-message-util';
  9. export default class FakeTimers {
  10. private _clock;
  11. private _config;
  12. private _fakingTime;
  13. private _global;
  14. private _fakeTimers;
  15. private _maxLoops;
  16. constructor({ global, config, maxLoops, }: {
  17. global: NodeJS.Global;
  18. config: StackTraceConfig;
  19. maxLoops?: number;
  20. });
  21. clearAllTimers(): void;
  22. dispose(): void;
  23. runAllTimers(): void;
  24. runOnlyPendingTimers(): void;
  25. advanceTimersToNextTimer(steps?: number): void;
  26. advanceTimersByTime(msToRun: number): void;
  27. runAllTicks(): void;
  28. useRealTimers(): void;
  29. useFakeTimers(): void;
  30. reset(): void;
  31. setSystemTime(now?: number | Date): void;
  32. getRealSystemTime(): number;
  33. getTimerCount(): number;
  34. private _checkFakeTimers;
  35. }