question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fix React `propTypes` warning in tests

See original GitHub issue

We 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:closed
  • Created 8 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
vvocommented, Jan 26, 2016

we can get rid of those by calling NODE_ENV=production mocha… in the test script, this should do it (if we expect them)

0reactions
bobylitocommented, Jan 26, 2016

On it!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found