File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,17 @@ function runWithRealTimers(callback) {
16
16
17
17
function runWithJestRealTimers ( callback ) {
18
18
const timerAPI = {
19
- clearImmediate,
20
19
clearInterval,
21
20
clearTimeout,
22
- setImmediate,
23
21
setInterval,
24
22
setTimeout,
25
23
}
24
+ if ( typeof setImmediate === 'function' ) {
25
+ timerAPI . setImmediate = setImmediate
26
+ }
27
+ if ( typeof clearImmediate === 'function' ) {
28
+ timerAPI . clearImmediate = clearImmediate
29
+ }
26
30
27
31
jest . useRealTimers ( )
28
32
Original file line number Diff line number Diff line change 1
1
import {
2
2
getWindowFromNode ,
3
3
getDocument ,
4
- setImmediate ,
5
4
setTimeout ,
6
5
clearTimeout ,
7
6
runWithRealTimers ,
@@ -39,7 +38,7 @@ function waitForDomChange({
39
38
40
39
function onDone ( error , result ) {
41
40
clearTimeout ( timer )
42
- setImmediate ( ( ) => observer . disconnect ( ) )
41
+ setTimeout ( ( ) => observer . disconnect ( ) , 0 )
43
42
if ( error ) {
44
43
reject ( error )
45
44
} else {
You can’t perform that action at this time.
0 commit comments