File tree 1 file changed +5
-11
lines changed
1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -81,15 +81,15 @@ function waitFor(
81
81
jest . advanceTimersByTime ( interval )
82
82
} )
83
83
84
+ // Could have timed-out
85
+ if ( finished ) {
86
+ break
87
+ }
84
88
// It's really important that checkCallback is run *before* we flush
85
89
// in-flight promises. To be honest, I'm not sure why, and I can't quite
86
90
// think of a way to reproduce the problem in a test, but I spent
87
91
// an entire day banging my head against a wall on this.
88
92
checkCallback ( )
89
-
90
- if ( finished ) {
91
- break
92
- }
93
93
}
94
94
} else {
95
95
try {
@@ -106,9 +106,6 @@ function waitFor(
106
106
}
107
107
108
108
function onDone ( error , result ) {
109
- if ( finished ) {
110
- return
111
- }
112
109
finished = true
113
110
clearTimeout ( overallTimeoutTimer )
114
111
@@ -137,7 +134,7 @@ function waitFor(
137
134
}
138
135
139
136
function checkCallback ( ) {
140
- if ( finished || promiseStatus === 'pending' ) return
137
+ if ( promiseStatus === 'pending' ) return
141
138
try {
142
139
const result = runWithExpensiveErrorDiagnosticsDisabled ( callback )
143
140
if ( typeof result ?. then === 'function' ) {
@@ -163,9 +160,6 @@ function waitFor(
163
160
}
164
161
165
162
function handleTimeout ( ) {
166
- if ( finished ) {
167
- return
168
- }
169
163
let error
170
164
if ( lastError ) {
171
165
error = lastError
You can’t perform that action at this time.
0 commit comments