@testing-library/dom
Advanced tools
Comparing version 8.4.0 to 8.5.0
@@ -18,3 +18,3 @@ "use strict"; | ||
asyncUtilTimeout: 1000, | ||
// this is to support React's async `act` function. | ||
// asyncWrapper and advanceTimersWrapper is to support React's async `act` function. | ||
// forcing react-testing-library to wrap all async functions would've been | ||
@@ -27,2 +27,3 @@ // a total nightmare (consider wrapping every findBy* query and then also | ||
asyncWrapper: cb => cb(), | ||
unstable_advanceTimersWrapper: cb => cb(), | ||
eventWrapper: cb => cb(), | ||
@@ -29,0 +30,0 @@ // default value for the `hidden` option in `ByRole` queries |
@@ -47,2 +47,5 @@ "use strict"; | ||
if (usingJestFakeTimers) { | ||
const { | ||
unstable_advanceTimersWrapper: advanceTimersWrapper | ||
} = (0, _config.getConfig)(); | ||
checkCallback(); // this is a dangerous rule to disable because it could lead to an | ||
@@ -67,3 +70,5 @@ // infinite loop. However, eslint isn't smart enough to know that we're | ||
jest.advanceTimersByTime(interval); // It's really important that checkCallback is run *before* we flush | ||
advanceTimersWrapper(() => { | ||
jest.advanceTimersByTime(interval); | ||
}); // It's really important that checkCallback is run *before* we flush | ||
// in-flight promises. To be honest, I'm not sure why, and I can't quite | ||
@@ -79,5 +84,7 @@ // think of a way to reproduce the problem in a test, but I spent | ||
await new Promise(r => { | ||
setTimeout(r, 0); | ||
jest.advanceTimersByTime(0); | ||
await advanceTimersWrapper(async () => { | ||
await new Promise(r => { | ||
setTimeout(r, 0); | ||
jest.advanceTimersByTime(0); | ||
}); | ||
}); | ||
@@ -84,0 +91,0 @@ } |
{ | ||
"name": "@testing-library/dom", | ||
"version": "8.4.0", | ||
"version": "8.5.0", | ||
"description": "Simple and complete DOM testing utilities that encourage good testing practices.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
export interface Config { | ||
testIdAttribute: string | ||
/** | ||
* WARNING: `unstable` prefix means this API may change in patch and minor releases. | ||
* @param cb | ||
*/ | ||
unstable_advanceTimersWrapper(cb: (...args: unknown[]) => unknown): unknown | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -4,0 +9,0 @@ asyncWrapper(cb: (...args: any[]) => any): Promise<any> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2959876
24671
371