Skip to content

Commit 1bd90b1

Browse files
andrewhillcodeKent C. Dodds
authored andcommitted
feat: add asyncUtilTimeout to config (#339)
1 parent 1682f5a commit 1bd90b1

File tree

5 files changed

+5
-4
lines changed

5 files changed

+5
-4
lines changed

src/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// './queries' are query functions.
44
let config = {
55
testIdAttribute: 'data-testid',
6+
asyncUtilTimeout: 4500,
67
// this is to support React's async `act` function.
78
// forcing react-testing-library to wrap all async functions would've been
89
// a total nightmare (consider wrapping every findBy* query and then also

src/wait-for-dom-change.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {getConfig} from './config'
99

1010
function waitForDomChange({
1111
container = getDocument(),
12-
timeout = 4500,
12+
timeout = getConfig().asyncUtilTimeout,
1313
mutationObserverOptions = {
1414
subtree: true,
1515
childList: true,

src/wait-for-element-to-be-removed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function waitForElementToBeRemoved(
1111
callback,
1212
{
1313
container = getDocument(),
14-
timeout = 4500,
14+
timeout = getConfig().asyncUtilTimeout,
1515
mutationObserverOptions = {
1616
subtree: true,
1717
childList: true,

src/wait-for-element.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function waitForElement(
1111
callback,
1212
{
1313
container = getDocument(),
14-
timeout = 4500,
14+
timeout = getConfig().asyncUtilTimeout,
1515
mutationObserverOptions = {
1616
subtree: true,
1717
childList: true,

src/wait.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import waitForExpect from 'wait-for-expect'
22
import {getConfig} from './config'
33

4-
function wait(callback = () => {}, {timeout = 4500, interval = 50} = {}) {
4+
function wait(callback = () => {}, {timeout = getConfig().asyncUtilTimeout, interval = 50} = {}) {
55
return waitForExpect(callback, timeout, interval)
66
}
77

0 commit comments

Comments
 (0)