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
Have you ever thought about adding an assertion for propType warnings on a React component? One method for doing that in general is illustrated here, but wouldn't it be useful to have a dedicated assertion. In general, it seems to me that testing propType warnings is probably valuable, if one is taking their use seriously.
The text was updated successfully, but these errors were encountered:
I like this idea. At best if you can test both positively or negatively, to ascertain that it will complain where you need it to, and leave it where it shouldn't.
It should be possible to create an assertion that mocks console.error.
I have earlier been thinking about doing property based testing based on the prop types using unexpected-check. The challenge is that the prop types won't reveal any information about themselves, so you need something like https://github.com/reactjs/react-docgen to get the prop types. But it would be very cool just to say that a component shouldn't crash for valid prop types.
Have you ever thought about adding an assertion for propType warnings on a React component? One method for doing that in general is illustrated here, but wouldn't it be useful to have a dedicated assertion. In general, it seems to me that testing propType warnings is probably valuable, if one is taking their use seriously.
The text was updated successfully, but these errors were encountered: