You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am testing a HOC with componentDidCatch with Snapshot, and it is working but it displays an annoying message on my terminal. Do you know how can I hide that?
with-error.js
importReactfrom'react';import{wrapDisplayName,setDisplayName}from'recompose';constErrorPage=()=><h1>There is an error</h1>;exportdefaulthasError=>BaseComponent=>{classWithErrorBoundaryextendsReact.Component{state={error: false};componentWillReceiveProps(nextProps){if(hasError(nextProps)&&!this.state.error){this.setState({error: true});}}componentDidCatch(){this.setState({error: true});}render(){returnthis.state.error ? <ErrorPage/> : <BaseComponent{...this.props}/>;}}returnsetDisplayName(wrapDisplayName(BaseComponent,'ErrorCatcher'))(WithErrorBoundary);};
with.error.test.js
it('should display the error page if it catchs an error',()=>{constComponent=withError()(()=>{thrownewError('Error');});constsubject=renderer.create(<Component/>).toJSON();expect(subject).toMatchSnapshot();});
The error message
I found this issue, but even with enzyme I got the same error. enzymejs/enzyme#1255
react: ^16.3.2 jest: ^22.4.2
Thanks,
Please note that this issue tracker is not a help form and this issue will be closed.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
💬 Questions and Help
Hi,
I am testing a HOC with componentDidCatch with Snapshot, and it is working but it displays an annoying message on my terminal. Do you know how can I hide that?
with-error.js
with.error.test.js
The error message
I found this issue, but even with enzyme I got the same error.
enzymejs/enzyme#1255
react: ^16.3.2
jest: ^22.4.2
Thanks,
Please note that this issue tracker is not a help form and this issue will be closed.
For questions or help please see:
The text was updated successfully, but these errors were encountered: