facebook/react · error
363
363
Error message
Test selector API is not supported by this renderer.
What it means
findAllNodes(hostRoot, selectors) is the entry point of React's internal test-selector API. It first checks the host-config flag supportsTestSelectors: the DOM bindings set it to true (react-dom-bindings/src/client/ReactFiberConfigDOM.js), but renderers that re-export ReactFiberConfigWithNoTestSelectors — react-native's Fabric renderer, react-art, most thin custom renderers — set it to false, and custom reconcilers get it from $$$config.supportsTestSelectors. Calling findAllNodes through a renderer that does not implement the selector host methods throws immediately.
Source
Thrown at packages/react-reconciler/src/ReactTestSelectors.js:315
} else {
let child = fiber.child;
while (child !== null) {
stack.push(child, selectorIndex);
child = child.sibling;
}
}
}
return false;
}
export function findAllNodes(
hostRoot: Instance,
selectors: Array<Selector>,
): Array<Instance> {
// $FlowFixMe[constant-condition]
if (!supportsTestSelectors) {
throw new Error('Test selector API is not supported by this renderer.');
}
const root = findFiberRootForHostRoot(hostRoot);
const matchingFibers = findPaths(root, selectors);
const instanceRoots: Array<Instance> = [];
const stack = Array.from(matchingFibers);
let index = 0;
while (index < stack.length) {
const node = stack[index++] as any as Fiber;
const tag = node.tag;
if (
tag === HostComponent ||
tag === HostHoistable ||
tag === HostSingleton
) {
if (isHiddenSubtree(node)) {View on GitHub (pinned to eafeac097b)
Solutions
- Use a renderer that implements test selectors: the DOM renderer (react-dom) is the reference implementation where supportsTestSelectors is true
- If you own the custom reconciler, implement the host-config test-selector methods (getInstanceFromNode, getTextContent, matchAccessibilityRole, isHiddenSubtree, getBoundingRect, setFocusIfFocusable, setupIntersectionObserver) and set supportsTestSelectors: true in the Reconciler config
- Otherwise replace findAllNodes with your environment's query API (React Native test queries, testing-library queries, renderer.toJSON traversal)
Example fix
// before (custom reconciler, selectors unsupported)
const Reconciler = require('react-reconciler');
module.exports = Reconciler({/* host config without test-selector methods */});
findAllNodes(root, [createRoleSelector('button')]); // throws
// after
const Reconciler = require('react-reconciler');
module.exports = Reconciler({
// ...host config...
supportsTestSelectors: true,
getInstanceFromNode(node) { /* return Fiber or null */ },
getTextContent(node) { /* return string */ },
// ...other required host methods
}); Defensive patterns
Strategy: try-catch
Validate before calling
// The flag is not publicly exported; detect by renderer identity
function rendererSupportsTestSelectors(renderer: string): boolean {
return renderer === 'react-dom'; // Fabric/art/custom renderers re-export ReactFiberConfigWithNoTestSelectors
} Try / catch
try {
const nodes = findAllNodes(hostRoot, selectors);
} catch (e) {
if (e instanceof Error && e.message === 'Test selector API is not supported by this renderer.') {
// fall back to renderer-native queries (testing-library, RN TestRenderer)
} else throw e;
} Prevention
- Treat the test-selector API as DOM-only unless your custom reconciler explicitly sets supportsTestSelectors: true with the full host-method set
- Keep selector-based test helpers behind an abstraction so a non-DOM renderer can swap in native queries
- When building a custom renderer, decide up front whether to implement the test-selector host surface (getInstanceFromNode, getBoundingRect, setupIntersectionObserver, ...)
When it happens
Trigger: Calling findAllNodes on a renderer built with react-reconciler whose config leaves supportsTestSelectors false or undefined; using react-native-renderer internals (ReactFiberConfigFabric re-exports the no-selectors config); third-party renderers (ink, react-three-fiber, react-pdf) that never implemented the required host methods such as getInstanceFromNode, getTextContent, matchAccessibilityRole, isHiddenSubtree, getBoundingRect, setFocusIfFocusable, setupIntersectionObserver.
Common situations: Porting a component test harness written against react-dom's internal testing build (e.g. ReactDOMTestingFB exports) to React Native or a custom renderer; upgrading a custom reconciler where the config object changed shape and supportsTestSelectors silently fell back to falsy; running FB-style selector tests against a non-DOM renderer.
Related errors
AI-assisted analysis of facebook/react@eafeac097b (2026-08-21).
Data as JSON: /api/errors/0fe0eb643724d7f8.
Report an issue: GitHub.