You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// we *could* (maybe should?) use `advanceTimersToNextTimer` but it's
81
-
// possible that could make this loop go on forever if someone is using
82
-
// third party code that's setting up recursive timers so rapidly that
83
-
// the user's timer's don't get a chance to resolve. So we'll advance
84
-
// by an interval instead. (We have a test for this case).
85
-
jest.advanceTimersByTime(interval)
86
-
})
87
-
88
-
// In this rare case, we *need* to wait for in-flight promises
89
-
// to resolve before continuing. We don't need to take advantage
90
-
// of parallelization so we're fine.
91
-
// https://stackoverflow.com/a/59243586/971592
92
-
// eslint-disable-next-line no-await-in-loop
93
-
awaitadvanceTimersWrapper(async()=>{
94
-
awaitnewPromise(r=>{
95
-
setTimeout(r,0)
96
-
jest.advanceTimersByTime(0)
97
-
})
98
-
})
99
-
}catch(error){
62
+
if(!jestFakeTimersAreEnabled()){
63
+
consterror=newError(
64
+
`Changed from using fake timers to real timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to real timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830`,
} while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing what timers your test is using. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830`,
130
+
`Changed from using real timers to fake timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to fake timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830`,
0 commit comments