Skip to content

Commit 8891120

Browse files
committed
invariant initial checkCallback
1 parent 233b57f commit 8891120

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/wait-for.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ function waitFor(
4949

5050
const overallTimeout = setTimeout(handleTimeout, timeout)
5151
const intervalId = setInterval(handleInterval, interval)
52+
checkCallback()
5253

5354
const wasUsingJestFakeTimers = jestFakeTimersAreEnabled()
5455
if (wasUsingJestFakeTimers) {
55-
checkCallback()
5656
// this is a dangerous rule to disable because it could lead to an
5757
// infinite loop. However, eslint isn't smart enough to know that we're
5858
// setting finished inside `onDone` which will be called when we're done
@@ -93,7 +93,6 @@ function waitFor(
9393
const {MutationObserver} = getWindowFromNode(container)
9494
observer = new MutationObserver(handleInterval)
9595
observer.observe(container, mutationObserverOptions)
96-
checkCallback()
9796
}
9897

9998
function onDone(error, result) {

0 commit comments

Comments
 (0)