CodeVetter · Repo Unpack · Feature catalog
testing-library/react-testing-library
The user-facing surface is an API for test authors. It supports rendering, updating, hydration, hooks, interactions, diagnostics, and test isolation. DOM Testing Library exports broaden that surface without duplicating query implementations here.
- render accepts React UI and returns container, baseElement, bound queries, debug, rerender, unmount, and asFragment.
- Custom container and baseElement options control mounting and query scope; without either, render creates a div under document.body.
- hydrate attaches React to existing markup, while legacyRoot selects older rendering APIs only when ReactDOM.render exists.
- wrapper supplies a surrounding component, and reactStrictMode can be configured globally or overridden per render.
- renderHook exposes a stable result ref, rerender, and unmount, with initialProps passed to the hook callback.
- fireEvent forwards DOM event helpers and adds React-specific enter/leave, selection, and focus/blur event sequences; act is also publicly exported.
- Consumers receive DOM Testing Library exports, including screen and asynchronous query utilities used in the integration tests.
- cleanup is public and normally registered automatically; consumers can choose the pure entrypoint or load dont-cleanup-after-each.js to control teardown themselves.