CodeVetter · Repo Unpack · Data flow
testing-library/react-testing-library
React nodes and render options enter the root orchestration layer, then become DOM content and query-bound results. Configuration and scheduling state are shared within the loaded modules and test global. Hook output and snapshots are transient outputs rather than durable persistence.
- render rejects a supplied onUncaughtError and unsupported legacyRoot before defaulting baseElement or allocating a container.
- A new container selects a root factory and records the root in both tracking structures; a known container retrieves its existing root by scanning mountedRootEntries.
- UI is first wrapped in the optional wrapper component, then optionally enclosed in StrictMode, before rendering or hydration inside act.
- onCaughtError and onRecoverableError flow into createRoot or hydrateRoot at root creation; they are not supplied anew when an existing root is reused.
- Queries bind to baseElement, whereas asFragment serializes container.innerHTML into a DocumentFragment and debug formats its selected element through prettyDOM.
- configure evaluates functional deltas against merged configuration, forwards non-reactStrictMode fields to DOM Testing Library, and assigns reactStrictMode in RTL's local config.
- renderHook computes pendingResult during TestComponent rendering, publishes it to result.current in useEffect, and passes new rerender arguments as renderCallbackProps.
- cleanup unmounts roots inside act, removes only containers directly under document.body, and clears in-memory tracking; custom parent elements remain outside that removal boundary.