Causes React PropType errors to fail the test
Using npm:
$ npm install --save-dev react-proptype-error-catcher
or
$ yarn add -D react-proptype-error-catcher
in jest config (jest.config.js) add to setupFilesAfterEnv
like:
setupFilesAfterEnv: [
'react-proptype-error-catcher/register',
],
Or if using setupTests.js
like for create-react-app (CRA) then add like
import 'react-proptype-error-catcher/register';
If wanted to only turn on per test use this pattern:
import proptype_error_catcher from 'react-proptype-error-catcher'
proptype_error_catcher()
it('with normal props it should render without errors', () => {
// test logic
})