File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ function copyStackTrace(target, source) {
16
16
}
17
17
18
18
function waitFor (
19
- callback ,
19
+ originalCallback ,
20
20
{
21
21
container = getDocument ( ) ,
22
22
timeout = getConfig ( ) . asyncUtilTimeout ,
@@ -41,6 +41,10 @@ function waitFor(
41
41
throw new TypeError ( 'Received `callback` arg must be a function' )
42
42
}
43
43
44
+ // callback will be replaced by a noop function as soon as it finishes
45
+ // to prevent callback leaking calls
46
+ let callback = originalCallback ;
47
+
44
48
return new Promise ( async ( resolve , reject ) => {
45
49
let lastError , intervalId , observer
46
50
let finished = false
@@ -107,6 +111,7 @@ function waitFor(
107
111
108
112
function onDone ( error , result ) {
109
113
finished = true
114
+ callback = ( ) => { } ;
110
115
clearTimeout ( overallTimeoutTimer )
111
116
112
117
if ( ! usingJestFakeTimers ) {
You can’t perform that action at this time.
0 commit comments