fix React `propTypes` warning in tests
See original GitHub issueWe are currently generating a bit of noise in the tests because of React warning on props.
Warning: Failed propType: Required prop `ariaLabel` was not specified in `PaginationLink`.
Warning: Failed propType: Required prop `range` was not specified in `Slider`.
Warning: Failed propType: Required prop `start` was not specified in `Slider`.
Warning: Failed propType: Required prop `range` was not specified in `Nouislider`.
Warning: Failed propType: Required prop `start` was not specified in `Nouislider`.
Warning: Each child in an array or iterator should have a unique "key" prop. Check the top-level render call using <div>. See https://fb.me/react-warning-keys for more information.
Warning: Failed propType: Required prop `setIndex` was not specified in `IndexSelector`.
Warning: Failed propType: Required prop `hasResults` was not specified in `undefined-AutoHide`.
Warning: Failed propType: Required prop `hideWhenNoResults` was not specified in `undefined-AutoHide`.
Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).
Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components)
We’ll have to clean that. I also think our propTypes checks are not really in sync with the code
Issue Analytics
- State:
- Created 8 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Don't Call PropTypes Warning - React
Don't call PropTypes directly ... Using PropTypes in any other way than annotating React components with them is no longer supported: var apiShape...
Read more >Making unit tests fail when PropTypes error - Jack Franklin
When running our test suite with Jest, I noticed that I'd often miss the console warnings that the PropTypes library emits if some...
Read more >Add ability to throw error instead of warning in tests #28 - GitHub
There is a workaround for throwing an error on warnings. We can use getStack argument. PropTypes.checkPropTypes(spec, values ...
Read more >How to validate React props using PropTypes - LogRocket Blog
Learn how to validate props with React PropTypes, React's internal mechanism for adding type checking to component props.
Read more >Why does my Jest test of React propTypes break when using ...
"Warning: Failed prop type: Invalid prop 'myProp2' supplied to 'MyComponent'." This means, though, that only the first non- null unacceptable ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
we can get rid of those by calling NODE_ENV=production mocha… in the test script, this should do it (if we expect them)
On it!