OSS TanbouSign in with GitHub

A React DOM testing library that queries by roles and accessible names to verify user-visible behavior

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
19,660
Primary language
JavaScript
License
MIT
Repository last updated
Aug 27, 2026
On this page

Overview

React Testing Library tests React interfaces through the text, roles, and accessible names users perceive instead of component internals. Its DOM Testing Library queries help tests survive implementation refactors.

Features and best fit

Hands-on tested within the scope below · Content checked:

Key features

What it verifies

render mounts a component into the DOM, and queries such as screen.getByRole locate interactive elements. fireEvent sends DOM events, while findBy and waitFor handle asynchronous updates.

Sources: [1][2][3]

Best fit

Where it fits

It fits React buttons, forms, and dialogs whose contract should be accessible names plus user interactions. The pinned example clicks Count 0 and requires the interface to update to Count 1.

Sources: [1][2]

Before adoption

What to check before running

Version 16.3.3 requires Node.js 18 or later, React 18 or 19, and @testing-library/dom 10. JSDOM does not reproduce every browser feature or layout calculation, so browser tests may still be needed. The LICENSE is MIT.

Sources: [3][4][5]

16.3.3 / macOS, Node.js 24.18.0, isolated npm project with JSDOM 27.0.0

Rendered a counter, clicked it by role and accessible name, and verified the visible output Count 1.

Official sources

  1. [1]testing-library/react-testing-library README at v16.3.3(2026-10-05)
  2. [2]React Testing Library official documentation(2026-10-05)
  3. [3]React Testing Library v16.3.3 source(2026-10-05)
  4. [4]testing-library/react-testing-library LICENSE at v16.3.3(2026-10-05)
  5. [5]testing-library/react-testing-library GitHub metadata(2026-10-05)
Supplemental curator note

It fits teams that want React tests anchored in visible roles and interactions. Start with a small state update queried by role and accessible name, avoiding implementation-specific classes or internal state.

Try it in 3 steps

  1. 1

    Create a pinned DOM test environment

    This JSDOM 27.0.0 sample requires Node.js 20 or later and npm; React Testing Library 16.3.3 itself supports Node.js 18 or later. Install the pinned packages in a temporary project.

    demo=$(mktemp -d "${TMPDIR:-/tmp}/react-testing-library.XXXXXX") && cd "$demo" && npm init -y >/dev/null && npm install --save-exact @testing-library/react@16.3.3 @testing-library/dom@10.4.1 react@19.2.0 react-dom@19.2.0 jsdom@27.0.0
  2. 2

    Write a user interaction check

    Find the Count 0 button by role and accessible name, click it, and query Count 1 by role again.

    printf '%s\n' 'import {JSDOM} from '\''jsdom'\''' 'const dom=new JSDOM('\''<!doctype html><html><body></body></html>'\'')' 'globalThis.window=dom.window;globalThis.document=dom.window.document' 'Object.defineProperty(globalThis,'\''navigator'\'',{value:dom.window.navigator,configurable:true})' 'globalThis.HTMLElement=dom.window.HTMLElement;globalThis.Node=dom.window.Node' 'const React=await import('\''react'\'')' 'const {render,screen,fireEvent,cleanup}=await import('\''@testing-library/react'\'')' 'function Counter(){const [count,setCount]=React.useState(0);return React.createElement('\''button'\'',{onClick:()=>setCount(n=>n+1)},`Count ${count}`)}' 'render(React.createElement(Counter))' 'fireEvent.click(screen.getByRole('\''button'\'',{name:'\''Count 0'\''}))' 'console.log(screen.getByRole('\''button'\'',{name:'\''Count 1'\''}).textContent)' 'cleanup()' > demo.mjs
  3. 3

    Verify the visible update

    Run under JSDOM in Node.js and require the user-visible button text to update to Count 1.

    test "$(node demo.mjs)" = "Count 1"
Check the official README

Growth

Growth trends · Last 30 days

19,660 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
0
Open PRs
19

Development activity is still being collected.

Built with

Categories and tags

Categories

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • reactjs
  • testing
  • javascript
Stars
19,660
Forks
1,169
Watchers
143
Open issues
63
Contributors
168
Owner type
Organization
Primary language
JavaScript
License
MIT
Repository last updated
Aug 27, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?