Skip to content

Commit b1252e3

Browse files
committed
Use waitForWrapper
1 parent c7de142 commit b1252e3

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@babel/runtime": "^7.12.5"
4949
},
5050
"devDependencies": {
51-
"@testing-library/dom": "^10.0.0",
51+
"@testing-library/dom": "https://pkg.csb.dev/testing-library/dom-testing-library/commit/8abda5aa/@testing-library/dom",
5252
"@testing-library/jest-dom": "^5.11.6",
5353
"@types/react": "^19.0.0",
5454
"@types/react-dom": "^19.0.0",
@@ -63,7 +63,7 @@
6363
"typescript": "^5.9.3"
6464
},
6565
"peerDependencies": {
66-
"@testing-library/dom": "^10.0.0",
66+
"@testing-library/dom": "^11.0.0",
6767
"@types/react": "^18.0.0 || ^19.0.0",
6868
"@types/react-dom": "^18.0.0 || ^19.0.0",
6969
"react": "^18.0.0 || ^19.0.0",

src/pure.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,14 @@ async function waitForMicrotasks() {
3232

3333
configureDTL({
3434
unstable_advanceTimersWrapper: async scope => {
35-
if (getIsReactActEnvironment()) {
36-
return actIfEnabled(scope)
37-
} else {
38-
const result = await scope()
39-
await waitForMicrotasks()
40-
return result
41-
}
35+
const result = await scope()
36+
await waitForMicrotasks()
37+
return result
4238
},
43-
// We just want to run `waitFor` without IS_REACT_ACT_ENVIRONMENT
44-
// But that's not necessarily how `asyncWrapper` is used since it's a public method.
45-
// Let's just hope nobody else is using it.
46-
asyncWrapper: async cb => {
39+
eventWrapper: actIfEnabled,
40+
asyncWrapper: actIfEnabled,
41+
// Run `waitFor` without IS_REACT_ACT_ENVIRONMENT
42+
waitForWrapper: async cb => {
4743
const previousActEnvironment = getIsReactActEnvironment()
4844
setIsReactActEnvironment(false)
4945
try {
@@ -52,7 +48,6 @@ configureDTL({
5248
setIsReactActEnvironment(previousActEnvironment)
5349
}
5450
},
55-
eventWrapper: actIfEnabled,
5651
})
5752

5853
// Ideally we'd just use a WeakMap where containers are keys and roots are values.

0 commit comments

Comments
 (0)