Adding to @jonrsharpe's answer
https://mcmap.net/q/1251780/-how-to-set-waitfor-options-globally-in-react-testing-library
You can configure the timeout of async methods for @testing-library/react
& @testing-library/dom
in a setupTests.js / setupTests.ts file:
import { configure as configureReact } from "@testing-library/react";
import { configure as configureDom } from "@testing-library/dom";
configureReact({ asyncUtilTimeout: 5000 });
configureDom({ asyncUtilTimeout: 5000 });
But if you need to configure it for async methods of any other testing-library
package then that needs to be configured for each async method, for ex.
waitFor(callback_func, { timeout: 5000 });
or create a helper function as suggested by @Baruch
https://mcmap.net/q/1251780/-how-to-set-waitfor-options-globally-in-react-testing-library