-
-
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 regex to match the story's kind #892
Comments
Comment by olistic I guess I'm submitting the PR anyway, it's simple enough and I need it for my projects. |
Comment by alexfedoseev Why not just writing snapshots next to the stories file? W/o dummy regexp for each component. |
@olistic We're interested in this PR, if you'll submit it. We've moved to a mono-repo architecture, if you need help, let us know? |
@ndelangen @shilman I migrated the changes from the old repo and made sure the linter passes. PR is now open against the mono-repo! |
I think that closes this issue? |
I really like this feature, when did you plan to release it? |
There's no date yet, sorry. Next release will be 3.0.0. |
@marcoala I had published a fork of the old storyshots repo in npm, which includes this feature. I'm using it in my projects until 3.0.0 is released. Just |
@olistic Thanks! |
I hope this does't sound dumb, but what do you think about adding a reverse of the same option. I know you can do an inverse regex but it may not be easy for some of us.
I can put together a PR |
@tmeasday What do you think? |
Is it possible to just write a negative regexp? |
@tmeasday I was using https://regex101.com to try to create inverse regexes and they were not working for some reason and i assumed maybe they were not supported in JS or required rear regex tricks. Tried the same inverse regexes in the browser console window and they worked. I am guessing maybe we may not need the reverse feature I was proposing. Although it might be convenient for people who find regexes intimidating. |
Maybe we can add something to the docs? I guess I'm not sure how common
this use case is?
…On Fri, 9 Jun 2017 at 19:52 Lukwago Allan ***@***.***> wrote:
@tmeasday <https://github.com/tmeasday> I was using https://regex101.com
to try to create inverse regexes and they were not working for some reason
and i assumed maybe they were not supported in JS or required rear regex
tricks. Tried the same inverse regexes in the browser console window and
they worked.
I am guessing maybe we may not need the reverse the same although it might
be convenient for people who find regexes intimidating.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#892 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIFyu6CXpZwQTelpZk3vycGStN17nYbks5sCRXBgaJpZM4M-aU8>
.
|
I agree we could add something to the docs in form of an example or leave as is. I doubt its a common use case. |
If you want to send a PR of what you did (I don't know how to write a negative regexp myself ;) ), that'd be super! |
Just sent a PR #1317 |
@epicallan I tried to use your regexp from docs and I have a file named |
@tirli |
@igor-dv The same as in docs: |
storyKindRegex is for the storyKind (the first parameter you provide to the |
@igor-dv Now it works :) Thank you |
Hi, I'm finding a way to separate the snapshots generated by storyshot. I read the README of storyshot and found here. import initStoryshots from '@storybook/addon-storyshots';
initStoryshots({
storyKindRegex: /^MyComponent$/
});
This statement indicates that if I use this option, then the snapshots will be separated and be placed nearby each component's source code. I gave it a try but just found the generated snapshots are still merged into a big file. The regex works well. So, do I misunderstand the documents? Or I have a wrong version (3.0.0) or this feature is not available yet? I would appreciate your help :) |
@matsumatsu233 Today the only way to do what you want is creating a storyshot.test.js for each story separately. For example having The limitation is from the Jest's side that do not support multiple snapshots per test file. But we have this #1584 PR that will probably help with this requirement in the future. |
Issue by olistic
Tuesday Mar 28, 2017 at 00:00 GMT
Originally opened as storybook-eol/storyshots#91
What do you guys think about having these two config options:
storyKindRegex
andstoryNameRegex
instead of the currentstoryRegex
?storyNameRegex
would behave just as the existingstoryRegex
, whilestoryKindRegex
would match against the story's kind, giving users more flexibility.For example, it could be used to solve #84 doing something like this:
Which will cause storyshots (or jest actually) to output a
__snapshots__
directory colocated with the component and with just its storyshots.If you think it is a good idea, I'm happy to submit a PR!
The text was updated successfully, but these errors were encountered: