File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,9 @@ function _runWithRealTimers(callback) {
25
25
26
26
const callbackReturnValue = callback ( )
27
27
28
- const usedJestFakeTimers = Object . entries ( timerAPI ) . some (
29
- ( [ name , func ] ) => func !== globalObj [ name ] ,
30
- )
28
+ const usedJestFakeTimers =
29
+ typeof jest !== 'undefined' &&
30
+ Object . entries ( timerAPI ) . some ( ( [ name , func ] ) => func !== globalObj [ name ] )
31
31
32
32
if ( usedJestFakeTimers ) {
33
33
jest . useFakeTimers ( timerAPI . setTimeout ?. clock ? 'modern' : 'legacy' )
Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ function waitFor(
52
52
53
53
const overallTimeoutTimer = setTimeout ( handleTimeout , timeout )
54
54
55
- const usingFakeTimers = jestFakeTimersAreEnabled ( )
56
- if ( usingFakeTimers ) {
55
+ const usingJestFakeTimers = jestFakeTimersAreEnabled ( )
56
+ if ( usingJestFakeTimers ) {
57
57
checkCallback ( )
58
58
// this is a dangerous rule to disable because it could lead to an
59
59
// infinite loop. However, eslint isn't smart enough to know that we're
@@ -107,7 +107,7 @@ function waitFor(
107
107
finished = true
108
108
clearTimeout ( overallTimeoutTimer )
109
109
110
- if ( ! usingFakeTimers ) {
110
+ if ( ! usingJestFakeTimers ) {
111
111
clearInterval ( intervalId )
112
112
observer . disconnect ( )
113
113
}
You can’t perform that action at this time.
0 commit comments