| 54 | const handleComponentDidCatch = jest.fn() |
| 55 | const onCaughtError = jest.fn() |
| 56 | class ErrorBoundary extends React.Component { |
| 57 | state = {error: null} |
| 58 | static getDerivedStateFromError(error) { |
| 59 | return {error} |
| 60 | } |
| 61 | componentDidCatch(error, errorInfo) { |
| 62 | handleComponentDidCatch(error, errorInfo) |
| 63 | } |
| 64 | render() { |
| 65 | if (this.state.error) { |
| 66 | return null |
| 67 | } |
| 68 | return this.props.children |
| 69 | } |
| 70 | } |
| 71 | function Thrower() { |
| 72 | throw thrownError |
| 73 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…