import { ReactTestInstance } from "react-test-renderer" ; export default function findParent ( instance , matcher ) { if ( matcher ( instance ) ) { return instance ; } if ( instance . parent ) { return findParent ( instance . parent , matcher ) ; } return null ; }