Skip to content

Commit 6b504ad

Browse files
author
Kent C. Dodds
committed
chore: auto-cleanup tests
1 parent 3dac132 commit 6b504ad

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

src/__tests__/helpers/test-utils.js

+2
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ function cleanup() {
1717
document.body.innerHTML = ''
1818
}
1919

20+
afterEach(cleanup)
21+
2022
export {render, renderIntoDocument, cleanup}

src/__tests__/role-helpers.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import {getRoles, logRoles, getImplicitAriaRoles} from '../role-helpers'
2-
import {render, cleanup} from './helpers/test-utils'
3-
4-
afterEach(cleanup)
2+
import {render} from './helpers/test-utils'
53

64
function setup() {
75
const {getByTestId} = render(`

src/__tests__/wait-for-dom-change.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import {waitForDomChange} from '../wait-for-dom-change'
2-
import {renderIntoDocument, cleanup} from './helpers/test-utils'
3-
4-
afterEach(cleanup)
2+
import {renderIntoDocument} from './helpers/test-utils'
53

64
test('waits for the dom to change in the document', async () => {
75
const {container} = renderIntoDocument('<div />')

src/__tests__/wait-for-element.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import {waitForElement} from '../wait-for-element'
2-
import {render, renderIntoDocument, cleanup} from './helpers/test-utils'
3-
4-
afterEach(cleanup)
2+
import {render, renderIntoDocument} from './helpers/test-utils'
53

64
test('waits for element to appear in the document', async () => {
75
const {rerender, getByTestId} = renderIntoDocument('<div />')

0 commit comments

Comments
 (0)