Skip to content

Commit 568a330

Browse files
Fix function not being mocked because of import
1 parent 932d6bf commit 568a330

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/setup-env.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import '@testing-library/jest-dom/extend-expect'
22
import jestSerializerAnsi from 'jest-serializer-ansi'
33

4-
import {configure} from '../src/config'
5-
64
expect.addSnapshotSerializer(jestSerializerAnsi)
75
// add serializer for MutationRecord
86
expect.addSnapshotSerializer({
@@ -39,7 +37,10 @@ beforeAll(() => {
3937
})
4038

4139
beforeEach(() => {
42-
configure({printPlaygroundLink: false})
40+
// Using require here instead of importing it at the top, because the import resulted in
41+
// a function being used before a test had the chance to mock it.
42+
// https://github.com/testing-library/dom-testing-library/pull/852#discussion_r557077851
43+
require('../src/config').configure({printPlaygroundLink: false})
4344
})
4445

4546
afterEach(() => {

0 commit comments

Comments
 (0)