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
`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`
66
+
);
67
+
if(stackTraceError){
68
+
copyStackTrace(error,stackTraceError);
69
+
}
70
+
reject(error);
71
+
return;
72
+
}
73
+
// we *could* (maybe should?) use `advanceTimersToNextTimer` but it's
74
+
// possible that could make this loop go on forever if someone is using
75
+
// third party code that's setting up recursive timers so rapidly that
76
+
// the user's timer's don't get a chance to resolve. So we'll advance
77
+
// by an interval instead. (We have a test for this case).
78
+
jest.advanceTimersByTime(interval);
79
+
80
+
// It's really important that checkExpectation is run *before* we flush
81
+
// in-flight promises. To be honest, I'm not sure why, and I can't quite
82
+
// think of a way to reproduce the problem in a test, but I spent
83
+
// an entire day banging my head against a wall on this.
84
+
checkExpectation();
85
+
86
+
// In this rare case, we *need* to wait for in-flight promises
87
+
// to resolve before continuing. We don't need to take advantage
// $FlowIgnore[incompatible-return] error and result are mutually exclusive
110
+
resolve(result);
111
+
}
112
+
}
113
+
114
+
functioncheckRealTimersCallback(){
115
+
if(jestFakeTimersAreEnabled()){
116
+
consterror=newError(
117
+
`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