-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 noMatchSnapshots
option.
#917
Add a noMatchSnapshots
option.
#917
Conversation
@@ -97,3 +97,7 @@ initStoryshots({ | |||
``` | |||
|
|||
Here is an example of [a regex](https://regex101.com/r/vkBaAt/2) which does not pass if `"Relay"` is in the name: `/^((?!(r|R)elay).)*$/`. | |||
|
|||
### `noMatchSnapshots` |
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.
@tmeasday What do you think about creating an option compareSnapshots
that defaults to true
? I don't like the double negative of noMatchSnapshots
. Or just call the option you added skipComparison
?
@tmeasday FWIW, I prefer your genericized solution to the current proposal. |
I'm having problems testing out the change. It's probably unrelated to your change. What I did:
With the following contents for import initStoryshots from 'storyshots'
initStoryshots({ noMatchSnapshots: true }) I get the error:
I tried I suspect this is related to Lerna. @tmeasday @ndelangen @aaronmcadam. Any help would be much appreciated. |
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.
I'd name this autoUpdate
and have it default value be false
.
But I'm not really feeling much for this feature myself, since updating snapshots is real easy already anyway.
Apologies, I didn't test the changes on the monorepo. My bad. Let me have a go at it and I'll ping you when I figure it out. |
@ndelangen -- the idea isn't to update the snapshots, it's to "smoke test" your stories but not to snapshot them. When you are early in development, pretty much every commit changes your snapshots, and so (in my experience) you tend to disable snapshot tests as they are too noisy. However it's pretty useful to know if a commit has broken a component (in the sense that it fails to render for some story). That's the idea of this change. @shilman -- I tend to agree that we should do the more generic thing. |
Storyshots wants to plugin to the version used by the app, not have its own version. So its a clear peer dep. Not sure it should depend on *storybook* at all given it is optional whether the user uses it or `react-native-storybook`
7cccef7
to
c1c0489
Compare
Closing this in favour of #1034, simple PR to follow |
See (storybook-eol/storyshots#93).
Issue:
The idea is that early on in a project, when things are changing a lot, snapshot tests are not particularly useful, but it's still helpful to "smoke test" all stories to ensure they run without error.
What I did
I added a
noMatchSnapshots
option to just setup a test that runs each story, without checking snapshots.How to test
initStoryshots({ noMatchSnapshots: true })
.jest
. Should pass.jest
again. Should still passjest
again. Should fail.Notes:
Perhaps it would make sense to just allow passing a custom
test
function, to cover off cases like this and storybook-eol/storyshots#76? Thenstoryshots
is more of a generic tool to integrate storybook with Jest.