How to use @jest/fake-timers - 1 common examples

To help you get started, we’ve selected a few @jest/fake-timers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sourcegraph / sourcegraph / shared / dev / jest-environment.js View on Github external
}
      return originalAddListener.apply(this, args)
    }
    global.removeEventListener = function(...args) {
      if (args[0] === 'error') {
        userErrorListenerCount--
      }
      return originalRemoveListener.apply(this, args)
    }
    /* eslint-enable @typescript-eslint/unbound-method */
    this.moduleMocker = new ModuleMocker(global)
    const timerConfig = {
      idToRef: id => id,
      refToId: ref => ref,
    }
    this.fakeTimers = new JestFakeTimers({
      config,
      global,
      moduleMocker: this.moduleMocker,
      timerConfig,
    })
    this.global.jsdom = this.dom
  }
  setup() {

@jest/fake-timers

MIT
Latest version published 1 year ago

Package Health Score

88 / 100
Full package analysis

Popular @jest/fake-timers functions