-
-
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 support for storyshots to save files according to different patterns #2517
Conversation
return getStoryshotFile(fileName); | ||
} | ||
const { dir } = path.parse(fileName); | ||
const name = sanitize(`${kind}--${story}`) |
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.
is --
the separator we want to use?
Codecov Report
@@ Coverage Diff @@
## master #2517 +/- ##
==========================================
+ Coverage 35.74% 95% +59.25%
==========================================
Files 472 6 -466
Lines 10134 40 -10094
Branches 1196 2 -1194
==========================================
- Hits 3622 38 -3584
+ Misses 5784 1 -5783
+ Partials 728 1 -727 Continue to review full report at Codecov.
|
I will test it soon too. Let's not merge for now. We want to fix things with angular in 3.3 before + we have this that might conflict. |
Cool. Just to make it clear, I am starting my vacations now and I will be out for a whole month. If you need me to make changes in the code it will need to wait. Sorry for that. |
If it's not impeding your work - it's ok. I think there won't be a much work here during the holidays. |
Hey @zvictor can you please fix the merge conflict? |
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.
You can't really remove the 'multiSnapshotWithOptions' it's already in 3.3 release, so renaming/removing it is a breaking change.
@zvictor , when you are back, let's revisit the implementation. I find it very useful to customize file names and extensions. |
@zvictor , do you want to continue this PR? There are some conflicts because of the refactoring. Or I can take it from here. |
@igor-dv sorry for my absence. I have been more busy than I expected since I came back from vacation and to be honest I cannot estimate when I would have some time available. Nonetheless, some of the changes that were made in the project since the creation of this PR are beyond my comprehension, so it would be a bit hard for me to do a proper merge. with all of that said, I would be more than happy if you could take over this PR and work on the needed changes. |
Sure |
Any updates on this? My use case is that I have multiple |
@bialesdaniel, I am working on it. |
The issue
In my setup, I always have a
cases.spec.js
that contains different props for my components. This file provides cases scenarios for both unit tests and storybook. With that in place, my components always have a standardstories.js
file next to it, that looks like that:I like organising the project like this because I get storybook "for free" while writing tests. However, the
multiSnapshotWithOptions
does not work the way I intended with such setup. I don't like that it always create a__snapshots__
folder with a single file on it.The alternative
I rewrote
getStoryshotFileName
to use the storieskind
andname
instead of the original filename:The API is quite simple:
with that I also killed the
multiSnapshotWithOptions
. I hope nobody minds 😄