-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a shallowSnapshot
option for storyshots test
functions
#1232
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1232 +/- ##
==========================================
- Coverage 13.73% 13.71% -0.03%
==========================================
Files 207 207
Lines 4638 4646 +8
Branches 510 512 +2
==========================================
Hits 637 637
- Misses 3550 3565 +15
+ Partials 451 444 -7
Continue to review full report at Codecov.
|
Can you explain why you'd want to shallow render stories? Is this something people want to do? |
I can only speak for myself, but when you have huge library of smaller react components, if you don't do shallow rendering you will get huge snapshot mismatches when you change those components. Granted that snapshot tests are really easy to update, but when you have large mismatches it is also increases the likelihood that you miss a real error. And secondly when you shallow render, it makes it that more important to make sure you have tests for all components. PS. It's not important for me to have this functionality built into storybooks as it's really easy to do yourself, but I was asked in #995 to make a PR. If this isn't something you'd like to have added that is fine aswell! :) |
@tmeasday Can you review this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great, Thanks @heinzmuller !
shallowSnapshot
option for storyshots test
functions
Issue: #995 StoryShots doesn't have a preset for shallow rendering snapshots
What I did
Added a test body for shallow rendering snapshots
How to test
Add this as a storyshot test file