Skip to content

Commit 6f657c5

Browse files
explain how to update wait to waitFor (#432)
added information for anyone trying to migrate an existing parameterless wait call
1 parent 76bbddd commit 6f657c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/dom-testing-library/api-async.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ The options object is forwarded to `waitFor`.
105105

106106
## `wait` (DEPRECATED, use waitFor instead)
107107

108-
## `wait`
109-
110108
```typescript
111109
function wait<T>(
112110
callback: () => void,
@@ -120,6 +118,8 @@ function wait<T>(
120118
```
121119
Previously, wait was a wrapper around wait-for-expect and used polling instead of a MutationObserver to look for changes. It is now an alias to waitFor and will be removed in a future release.
122120

121+
Unlike wait, the callback parameter is mandatory in waitFor. Although you can migrate an existing `wait()` call to `waitFor( () => {} )`, it is considered bad practice to use an empty callback because it will make the tests more fragile.
122+
123123
## `waitForDomChange` (DEPRECATED, use waitFor instead)
124124

125125
```typescript

0 commit comments

Comments
 (0)