We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a7b7252 commit a0bb005Copy full SHA for a0bb005
src/wait-for.js
@@ -106,6 +106,9 @@ function waitFor(
106
}
107
108
function onDone(error, result) {
109
+ if (finished) {
110
+ return
111
+ }
112
finished = true
113
clearTimeout(overallTimeoutTimer)
114
@@ -134,7 +137,7 @@ function waitFor(
134
137
135
138
136
139
function checkCallback() {
- if (promiseStatus === 'pending') return
140
+ if (finished || promiseStatus === 'pending') return
141
try {
142
const result = runWithExpensiveErrorDiagnosticsDisabled(callback)
143
if (typeof result?.then === 'function') {
@@ -160,6 +163,9 @@ function waitFor(
160
163
161
164
162
165
function handleTimeout() {
166
167
168
169
let error
170
if (lastError) {
171
error = lastError
0 commit comments