# testing-library/react-testing-library

🐐 Simple and complete React DOM testing utilities that encourage good testing practices.

Repository: https://github.com/testing-library/react-testing-library
Canonical: https://ross.abutalabs.com/products/react-testing-library
Homepage: https://testing-library.com/react
Language: JavaScript
License: MIT
License Family: permissive
Topics: reactjs, testing, javascript
Last push: 2026-04-02T07:04:36+00:00

## Health v2 (maintenance only)
Score: 73/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 75, release rhythm 54, longevity 100
- inputs: {"age_days": 3089, "days_push": 153, "days_rel": 226, "gap_med": 58.5, "n_releases_24m": 5}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 19645, forks 1167 (observed 2026-08-28T04:11:29.050317+00:00)

## What it is
React Testing Library is a lightweight set of utilities for testing React components by rendering them into a DOM and querying them the way a user would. It encourages tests that avoid implementation details, making test suites resilient to refactoring.

## Use cases
- test react components
- write maintainable ui tests that survive refactors
- query dom elements by label or role like a user would
- simulate user interactions in component tests
- migrate from enzyme to a modern testing approach
- test react hooks with renderHook
- improve accessibility by testing with semantic queries

## When to choose
- you write React component tests with Jest, Vitest, or another test runner
- you want user-centric tests that don't depend on component internals
- you want to encourage accessible markup via role- and label-based queries

## When to avoid
- you need end-to-end tests in a real browser (use Playwright or Cypress)
- you need to assert on component state, props, or lifecycle methods directly
- you are testing non-React frameworks (use the framework-specific Testing Library wrapper)

## Facets
- artifact type: library
- maturity: stable
- function: testing, e2e-testing, ui-components
- domain: testing, frontend, web-development, developer-tools
- platform: browser, cross-platform
- tags: react, dom-testing, user-centric-testing, jest, accessibility-testing, unit-testing, nodejs

## Member repositories
- testing-library/react-testing-library (main) score 73

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:29.050317+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-29T16:59:53.538960+00:00, confidence not recorded.
  - readme: https://github.com/testing-library/react-testing-library (fetched 2026-08-28T04:11:29.050317+00:00, sha d24a342400ff)
  - homepage: https://testing-library.com/react (fetched 2026-08-29T07:58:45.901678+00:00, sha 6cbad718f3ab)
  - site_page: https://testing-library.com/docs/react-testing-library/migrate-from-enzyme (fetched 2026-08-29T07:58:45.925253+00:00, sha 8a7a50993c53)
  - site_page: https://testing-library.com/docs (fetched 2026-08-29T07:58:45.911602+00:00, sha 294680c6ca00)
  - site_page: https://testing-library.com/docs/recipes (fetched 2026-08-29T07:58:45.914044+00:00, sha e707259ba080)
  - site_page: https://testing-library.com/docs/queries/about (fetched 2026-08-29T07:58:45.915731+00:00, sha 1bb7d31eef5f)
  - site_page: https://testing-library.com/docs/dom-testing-library/intro (fetched 2026-08-29T07:58:45.917767+00:00, sha 273a42fd0eae)
  - site_page: https://testing-library.com/docs/react-testing-library/example-intro (fetched 2026-08-29T07:58:45.919484+00:00, sha f66b3a236a0e)
  - site_page: https://testing-library.com/docs/react-testing-library/setup (fetched 2026-08-29T07:58:45.921321+00:00, sha 67bfcb205775)
  - site_page: https://testing-library.com/docs/react-testing-library/api (fetched 2026-08-29T07:58:45.923259+00:00, sha 098799db6085)
- Data as of 2026-08-30T08:39:29.467469+00:00.
