Packages

@testing-library/dom

10.4.2 · 13 Sep 2026MIT125.9M / weekRepositoryHomepagenpmAtom feed

Your version

8.0.0

major23 Jun 2021Where it was published

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 timeout in waitFor(callback, { interval, timeout } ) now uses the same clock as interval. Previously timeout was always using the real clock while interval was using the global clock which could've been mocked out. For the old behavior I'd recommend waitFor(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 in prettyDOM .If you whish to return to the old behavior, use a custom filterNode function. In this case prettyDOM(element, { filterNode: () => true }).

  • Breaking

    Node 10 is no longer supported. It reached its end-of-life on 30.04.2021.

Release note

Recommendations

  1. If you're using jest fake 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 timeout in waitFor(callback, { interval, timeout } ) now uses the same clock as interval. Previously timeout was always using the real clock while interval was using the global clock which could've been mocked out. For the old behavior I'd recommend waitFor(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 in prettyDOM .If you whish to return to the old behavior, use a custom filterNode function. In this case prettyDOM(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.