dom-testing-library
v7 released a new async util called waitFor
which satisfies the use cases of wait
, waitForElement
, and waitForDomChange
making them deprecated.
This rule aims to use waitFor
async util rather than previous deprecated ones.
Deprecated wait
async utils are:
wait
waitForElement
waitForDomChange
This rule will auto fix deprecated async utils for you, including the necessary empty callback for
waitFor
. This meanswait();
will be replaced withwaitFor(() => {});
Examples of incorrect code for this rule:
const foo = async () => {
await wait();
await wait(() => {});
await waitForElement(() => {});
await waitForDomChange();
await waitForDomChange(mutationObserverOptions);
await waitForDomChange({ timeout: 100});
};
Examples of correct code for this rule:
const foo = async () => {
// new waitFor method
await waitFor(() => {});
// previous waitForElementToBeRemoved is not deprecated
await waitForElementToBeRemoved(() => {});
};
When using dom-testing-library (or any other Testing Library relying on dom-testing-library) prior to v7.