@testing-library/dom
10.4.2 · 13 Sep 2026MIT125.9M / weekRepositoryHomepagenpmAtom feed
8.20.1 is the newest release of 8.x.
In short
5 breaking1 changed1 internal
- Breaking
Remove deprecated
waitFormDOMChange - Breaking
Remove deprecated
waitForElement - Breaking
The
timeoutinwaitFor(callback, { interval, timeout } )now uses the same clock asinterval. Previouslytimeoutwas always using the real clock whileintervalwas using the global clock which could've been mocked out. For the old behavior I'd recommendwaitFor(callback, { interval, timeout: Number.POSITIVE_INFINITY })and rely on your test runner to timeout considering real timers. - Breaking
<script />,<style />and comment nodes are now ignored by default inprettyDOM.If you whish to return to the old behavior, use a customfilterNodefunction. In this caseprettyDOM(element, { filterNode: () => true }). - Breaking
Node 10 is no longer supported. It reached its end-of-life on 30.04.2021.
Release note
Recommendations
If you're using
jestfake timers make sure you use modern timers
jest 27:-jest.useFakeTimers('legacy') +jest.useFakeTimers('modern') // jest.config.js -"timers": "legacy", +"timers": "modern",jest 26:
-jest.useFakeTimers() +jest.useFakeTimers('modern') // jest.config.js -"timers": "legacy", +"timers": "modern",
Breaking changes
- Breaking
Remove deprecated
waitFormDOMChange - Breaking
Remove deprecated
waitForElement - Breaking
The
timeoutinwaitFor(callback, { interval, timeout } )now uses the same clock asinterval. Previouslytimeoutwas always using the real clock whileintervalwas using the global clock which could've been mocked out. For the old behavior I'd recommendwaitFor(callback, { interval, timeout: Number.POSITIVE_INFINITY })and rely on your test runner to timeout considering real timers. - Breaking
<script />,<style />and comment nodes are now ignored by default inprettyDOM.If you whish to return to the old behavior, use a customfilterNodefunction. In this caseprettyDOM(element, { filterNode: () => true }). - Breaking
Node 10 is no longer supported. It reached its end-of-life on 30.04.2021.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.