Files
msw/config/polyfills-node.ts
Artem ZakharchenkoandGitHub d11b0a4804 feat: improve module formats (cjs, esm, iife) (#1247)
* chore: adopt "tsup"

* chore: copy worker with tsup

* chore: bundle iife correctly, fix call frames

* chore: inject "setTimeout" for node build

* chore: log worker checksum

* chore(postinstall): use early return over process.exit
2022-05-20 19:09:37 +02:00

9 lines
349 B
TypeScript

import { setTimeout as nodeSetTimeout } from 'timers'
// Polyfill the global "setTimeout" so MSW could be used
// with "jest.useFakeTimers()". MSW response handling
// is wrapped in "setTimeout", and without this polyfill
// you'd have to manually advance the timers for the response
// to finally resolve.
export const setTimeout = nodeSetTimeout