File tree Expand file tree Collapse file tree 2 files changed +32
-18
lines changed Expand file tree Collapse file tree 2 files changed +32
-18
lines changed Original file line number Diff line number Diff line change 1- // @flow
2- import act from './act' ;
3- import cleanup from './cleanup' ;
4- import debug from './debug' ;
5- import fireEvent from './fireEvent' ;
61import flushMicrotasksQueue from './flushMicrotasksQueue' ;
7- import render from './render' ;
8- import shallow from './shallow' ;
9- import waitForElement from './waitForElement' ;
10- import within from './within' ;
2+ import { cleanup } from './pure' ;
113
12- export { act } ;
13- export { cleanup } ;
14- export { debug } ;
15- export { fireEvent } ;
16- export { flushMicrotasksQueue } ;
17- export { render } ;
18- export { shallow } ;
19- export { waitForElement } ;
20- export { within } ;
4+ // if we're running in a test runner that supports afterEach
5+ // then we'll automatically run cleanup afterEach test
6+ // this ensures that tests run in isolation from each other
7+ // if you don't like this then either import the `pure` module
8+ // or set the RTL_SKIP_AUTO_CLEANUP env variable to 'true'.
9+ if ( typeof afterEach === 'function' && ! process . env . RTL_SKIP_AUTO_CLEANUP ) {
10+ afterEach ( async ( ) => {
11+ await flushMicrotasksQueue ( ) ;
12+ cleanup ( ) ;
13+ } ) ;
14+ }
15+
16+ export * from './pure' ;
Original file line number Diff line number Diff line change 1+ // @flow
2+ import act from './act' ;
3+ import cleanup from './cleanup' ;
4+ import debug from './debug' ;
5+ import fireEvent from './fireEvent' ;
6+ import flushMicrotasksQueue from './flushMicrotasksQueue' ;
7+ import render from './render' ;
8+ import shallow from './shallow' ;
9+ import waitForElement from './waitForElement' ;
10+
11+ export { act } ;
12+ export { cleanup } ;
13+ export { debug } ;
14+ export { fireEvent } ;
15+ export { flushMicrotasksQueue } ;
16+ export { render } ;
17+ export { shallow } ;
18+ export { waitForElement } ;
You can’t perform that action at this time.
0 commit comments