# testing-library/jest-dom

:owl: Custom jest matchers to test the state of the DOM

Repository: https://github.com/testing-library/jest-dom
Canonical: https://ross.abutalabs.com/products/jest-dom
Homepage: https://testing-library.com/docs/ecosystem-jest-dom
Language: JavaScript
License: MIT
License Family: permissive
Topics: testing, dom, jest, jest-matchers, jsdom, javascript, custom-matcher, react-testing-library, dom-testing-library, testing-library, testing-library-react
Last push: 2026-08-09T23:42:19+00:00

## Health v2 (maintenance only)
Score: 97/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 96, release rhythm 96, longevity 100
- inputs: {"age_days": 3068, "days_push": 24, "days_rel": 24, "gap_med": 13, "n_releases_24m": 12}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 4597, forks 420 (observed 2026-08-28T04:08:54.788416+00:00)

## What it is
A companion library for Testing Library that provides custom Jest matchers for asserting the state of DOM elements, such as visibility, attributes, text content, and form values. It extends Jest (and Jest-compatible expect like Vitest) with declarative, readable matchers like toBeInTheDocument and toHaveTextContent.

## Use cases
- assert an element is in the document in jest tests
- check if a dom element is visible or disabled
- test form input values in react components
- assert element has a css class or attribute
- verify accessible name and role of elements
- write readable dom assertions with vitest

## When to choose
- you use Jest or Vitest to test web UIs with a DOM
- you want declarative, user-centric DOM assertions alongside Testing Library
- you test React, Vue, or Angular components and need readable failure messages

## When to avoid
- you are not testing DOM-based UIs (e.g. Node-only or React Native without DOM)
- you use a test runner with an incompatible expect implementation
- you need a full test framework or runner rather than assertion matchers

## Facets
- artifact type: library
- maturity: stable
- function: testing, e2e-testing
- domain: testing, web-development, frontend, developer-tools
- platform: browser
- tags: jest, jest-matchers, dom, jsdom, vitest, testing-library, assertions, ui-testing, nodejs, javascript

## Member repositories
- testing-library/jest-dom (main) score 97

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:54.788416+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:19:48.659696+00:00, confidence not recorded.
  - readme: https://github.com/testing-library/jest-dom (fetched 2026-08-28T04:08:54.788416+00:00, sha 2b75a5415e87)
  - homepage: https://testing-library.com/docs/ecosystem-jest-dom (fetched 2026-08-29T09:05:17.393013+00:00, sha e14933d910f6)
  - site_page: https://testing-library.com/docs (fetched 2026-08-29T09:05:17.395770+00:00, sha 294680c6ca00)
  - site_page: https://testing-library.com/docs/recipes (fetched 2026-08-29T09:05:17.397467+00:00, sha e707259ba080)
  - site_page: https://testing-library.com/docs/queries/about (fetched 2026-08-29T09:05:17.399018+00:00, sha 1bb7d31eef5f)
  - site_page: https://testing-library.com/docs/dom-testing-library/intro (fetched 2026-08-29T09:05:17.401212+00:00, sha 273a42fd0eae)
  - site_page: https://testing-library.com/docs/user-event/intro (fetched 2026-08-29T09:05:17.403030+00:00, sha 8e6b835ab312)
  - site_page: https://testing-library.com/docs/ecosystem-bs-jest-dom (fetched 2026-08-29T09:05:17.404670+00:00, sha a2d6923cbcf7)
  - site_page: https://testing-library.com/docs/ecosystem-react-select-event (fetched 2026-08-29T09:05:17.406183+00:00, sha db59eb8c5f7f)
  - site_page: https://testing-library.com/docs/ecosystem-eslint-plugin-testing-library (fetched 2026-08-29T09:05:17.407724+00:00, sha 365f4acca6a1)
- Data as of 2026-08-30T08:39:29.467469+00:00.
