Error: Invariant Violation: findAllInRenderedTree(...): instance must be a composite component Error: Invariant Violation: findAllInRenderedTree(...): instance must be a composite component reactjs reactjs

Error: Invariant Violation: findAllInRenderedTree(...): instance must be a composite component


A composite component is a component which contains React Component (not div, span, ...) The method 'findRenderedDOMComponentWithTag' takes in parameter a composite component.

Try to parse the component directly in your case (jquery, js, ...) because it is not a composite one


This is late, but I just ran into this, and I haven't found a great answer for it.

My solution was to make a wrapper component in the test file

import { Component } from "react";class Wrapper extends Component {  render() {    return <YourComponent {...this.props} />  }}

and instead of calling

TestUtils.renderIntoDocument(    <YourComponent />);

call

TestUtils.renderIntoDocument(    <Wrapper />);

Doing this ensures that your component is a composite component and isn't a stateless function.

Hope this helps anyone else in the future!