File tree Expand file tree Collapse file tree 1 file changed +1
-29
lines changed Expand file tree Collapse file tree 1 file changed +1
-29
lines changed Original file line number Diff line number Diff line change @@ -12,20 +12,6 @@ import act, {
1212} from './act-compat'
1313import { fireEvent } from './fire-event'
1414
15- function jestFakeTimersAreEnabled ( ) {
16- /* istanbul ignore else */
17- if ( typeof jest !== 'undefined' && jest !== null ) {
18- return (
19- // legacy timers
20- setTimeout . _isMockFunction === true || // modern timers
21- // eslint-disable-next-line prefer-object-has-own -- No Object.hasOwn in all target environments we support.
22- Object . prototype . hasOwnProperty . call ( setTimeout , 'clock' )
23- )
24- } // istanbul ignore next
25-
26- return false
27- }
28-
2915configureDTL ( {
3016 unstable_advanceTimersWrapper : cb => {
3117 // Only needed to support test environments that enable fake timers after modules are loaded.
@@ -43,21 +29,7 @@ configureDTL({
4329 const previousActEnvironment = getIsReactActEnvironment ( )
4430 setReactActEnvironment ( false )
4531 try {
46- const result = await cb ( )
47- // Drain microtask queue.
48- // Otherwise we'll restore the previous act() environment, before we resolve the `waitFor` call.
49- // The caller would have no chance to wrap the in-flight Promises in `act()`
50- await new Promise ( resolve => {
51- setTimeout ( ( ) => {
52- resolve ( )
53- } , 0 )
54-
55- if ( jestFakeTimersAreEnabled ( ) ) {
56- jest . advanceTimersByTime ( 0 )
57- }
58- } )
59-
60- return result
32+ return await cb ( )
6133 } finally {
6234 setReactActEnvironment ( previousActEnvironment )
6335 }
You can’t perform that action at this time.
0 commit comments