Skip to content

Commit

Permalink
[Tests] react-compat: add act
Browse files Browse the repository at this point in the history
  • Loading branch information
Gangwani, Pawan authored and ljharb committed Mar 8, 2019
1 parent f5d4a5c commit 6428b57
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/enzyme-test-suite/test/_helpers/react-compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ let useMemo;
let useReducer;
let useRef;
let useState;
let act;

if (is('>=15.5 || ^16.0.0-alpha || ^16.3.0-alpha')) {
// eslint-disable-next-line import/no-extraneous-dependencies
Expand Down Expand Up @@ -117,6 +118,12 @@ if (is('^16.8.0-0')) {
useRef,
useState,
} = require('react'));

({
act,
} = require('react-dom/test-utils'));


} else {
useCallback = null;
useContext = null;
Expand All @@ -128,6 +135,7 @@ if (is('^16.8.0-0')) {
useReducer = null;
useRef = null;
useState = null;
act = null;
}

export {
Expand Down Expand Up @@ -157,4 +165,5 @@ export {
useReducer,
useRef,
useState,
act,
};

0 comments on commit 6428b57

Please sign in to comment.