React Testing Library

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

Library
npm
v16.3.3
19,655 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
64 /100 Good
Development Activity 40
Maintenance 48
Community 68
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
74 /100 Good
Architecture 75
Code Quality 80
Innovation 65
Learning Curve 75

React Testing Library (@testing-library/react) is a lightweight wrapper around react-dom and react-dom/test-utils (or react-test-renderer for React Native) that provides utilities for rendering React components and querying the resulting DOM the way an actual user would — by text, label, or role — rather than by internal implementation details like component instances or state. It exposes render(), fireEvent, screen (from the shared @testing-library/dom query engine), and renderHook() for testing custom hooks in isolation, plus an automatic cleanup that unmounts components between tests.

The library deliberately avoids exposing shallow rendering or internal component instances, pushing tests toward asserting on rendered output and user-observable behavior — the guiding principle behind the whole Testing Library family (DOM Testing Library, Vue Testing Library, and others). Since v13, it also absorbed the renderHook API previously shipped as the now-deprecated @testing-library/react-hooks package, making it the single canonical package for testing both components and hooks in React.

What You Get

  • render() to mount a React component into a jsdom container and get back query utilities (getByRole, getByText, etc.)
  • screen, exported from @testing-library/dom, for querying the whole rendered document without holding onto a render() result
  • fireEvent (and userEvent, in the companion @testing-library/user-event package) to simulate user interactions
  • renderHook() for testing custom React hooks in isolation, without needing to build a host component
  • Automatic component cleanup between tests plus configuration hooks (configure()) for test-id attribute names and async utility timeouts

Common Use Cases

  • Testing that a component renders expected text, roles, and accessible labels after user interaction
  • Testing custom React hooks (state, effects, context) in isolation via renderHook()
  • Writing integration-style tests for forms, modals, and interactive widgets that assert on DOM output rather than internal state
  • Replacing shallow-rendering-based test suites (e.g. from Enzyme) with behavior-driven, DOM-query-based tests

Under The Hood

Architecture The library’s core (src/pure.js) implements render() by mounting a component into a detached DOM container via react-dom/client’s createRoot (or react-dom for older React versions), wrapping updates in act() (src/act-compat.js handles cross-React-version act compatibility), and returning the container along with query helpers bound to it via @testing-library/dom’s getQueriesForElement; fireEvent (src/fire-event.js) dispatches native DOM events through the same act()-wrapped path so React’s state updates are flushed synchronously in tests.

Tech Stack Plain JavaScript (not TypeScript, though type declarations are hand-maintained under types/), built with kcd-scripts (Kent C. Dodds’ shared build/lint/test tooling), depending on @testing-library/dom for the actual query engine so DOM-querying logic is shared across the whole Testing Library family rather than reimplemented per framework.

Code Quality Extensively tested against its own behavior (src/tests covers render, rerender, cleanup, auto-cleanup, act compatibility, renderHook, error handling, and end-to-end scenarios), with CI-enforced coverage via codecov.yml and a validate script (lint + typecheck + test) gating changes — appropriate rigor for a library whose job is to be a trustworthy foundation for everyone else’s tests.

API Design The API is intentionally minimal — render, screen, fireEvent, renderHook, cleanup — and consistently steers users toward querying by accessible role/label/text rather than test IDs or component internals, which is the library’s core design philosophy; the tradeoff is that tests requiring instance-level assertions (rare in idiomatic usage) require dropping down to raw DOM APIs.

Used by 196 apps in this directory

TypeScript
76%
AGPL 3.0

Abby

Developer Tools · Product Management

166

Statically typed feature flags, remote config, and A/B testing with framework-native SDKs for TypeScript teams.

View details
31
Repo Health
70
Technical
64
Dependency
Built with
TypeScript 76%
MDX 18%
Updated 1 years ago
TypeScript
95%
MIT

Actual

Invoicing Finance

29,186

Local-first personal finance with envelope budgeting, end-to-end encryption, and multi-device sync — no subscription required.

View details
93
Repo Health
85
Technical
73
Dependency
Built with
TypeScript 95%
Updated 4 days ago
TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 5 days ago
Python
99%
MIT

Agent Lightning

AI Development

18,515

A Microsoft-built training framework that optimizes AI agents with reinforcement learning, automatic prompt optimization, or supervised fine-tuning — with near-zero code changes to your existing agent, in any framework.

View details
85
Repo Health
68
Technical
69
Dependency
Built with
Python 99%
Updated 4 days ago
Go
59%
Apache 2.0

agent-orchestrator

AI Agents · AI Code Assistants · Developer Tools

12,440

A local desktop workspace that gives every coding task its own agent, Git branch, and worktree, then tracks tasks, pull requests, CI, and reviews for 27 coding agents on one live Kanban board.

View details
86
Repo Health
83
Technical
68
Dependency
Built with
Go 59%
TypeScript 38%
Updated 4 days ago
TypeScript
86%
MIT

Agents Observe

Developer Tools

684

A real-time, fully local observability dashboard for Claude Code and Codex agent sessions — filtering, search, session replay, and token/cost breakdowns via an auto-starting MCP server.

View details
66
Repo Health
67
Technical
77
Dependency
Built with
TypeScript 86%
JavaScript 10%
Updated 4 weeks ago
TypeScript
95%
Apache 2.0

AionUi

AI Agents · Productivity

33,179

Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.

View details
85
Repo Health
76
Technical
66
Dependency
Built with
TypeScript 95%
Updated 3 weeks ago
Python
89%
Apache 2.0

Apache Airflow

Data Engineering

46,995

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
64
Dependency
Built with
Python 89%
Updated 4 days ago
TypeScript
72%
AGPL 3.0

APITable

Databases · Low Code Platforms

15,623

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
71
Repo Health
77
Technical
60
Dependency
Built with
TypeScript 72%
Java 22%
Updated 3 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers