| 21 | } |
| 22 | |
| 23 | export const act: typeof actImpl = fn => { |
| 24 | // only wrap in act if in test environment, breaks vite browser test if test utils are used otherwise |
| 25 | if ( |
| 26 | // @ts-ignore |
| 27 | typeof IS_REACT_ACT_ENVIRONMENT === 'boolean' |
| 28 | ? // @ts-ignore |
| 29 | IS_REACT_ACT_ENVIRONMENT |
| 30 | : typeof jest !== 'undefined' |
| 31 | ) { |
| 32 | return actImpl(fn); |
| 33 | } |
| 34 | return fn(); |
| 35 | }; |