Skip to content

Commit eade4f5

Browse files
author
=
committed
fix: make sure setTimeout exists on global
1 parent c0ed1ba commit eade4f5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/helpers.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ const globalObj = typeof window === 'undefined' ? global : window
55
// Currently this fn only supports jest timers, but it could support other test runners in the future.
66
function runWithRealTimers(callback) {
77
const usingJestFakeTimers =
8-
globalObj.setTimeout._isMockFunction && typeof jest !== 'undefined'
8+
globalObj.setTimeout &&
9+
globalObj.setTimeout._isMockFunction &&
10+
typeof jest !== 'undefined'
911

1012
if (usingJestFakeTimers) {
1113
jest.useRealTimers()

0 commit comments

Comments
 (0)