-
-
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
887 Generate snapshot per story file #1584
Merged
Merged
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
917f314
Use experemental jest-specific-snapshot to generate snapshot per stor…
igor-dv 1d54e27
Add multiSnapshotWithOptions + upgrade jest-specific-snapshot to 0.2.0
igor-dv 810a63b
Fix the case there is no "?"
igor-dv 5e60a9c
Merge branch 'master' into 887-generate-snapshot-per-story-file
igor-dv dc8bbd7
Use patchStoriesOfFunction for RN
igor-dv 8f9926f
Merge branch 'master' into 887-generate-snapshot-per-story-file
ndelangen 3a78efe
Merge branch 'master' into 887-generate-snapshot-per-story-file
igor-dv 9e20cb7
Merge branch 'master' into 887-generate-snapshot-per-story-file
igor-dv 0eb3093
Add fileName prop to the storybook client api
igor-dv 9f6e573
Try storyshot example pass on CI
igor-dv 1c1c9db
Save snapshots
igor-dv ca294e9
Merge branch 'master' into 887-generate-snapshot-per-story-file
igor-dv 3eb8390
Merge branch 'master' into 887-generate-snapshot-per-story-file
igor-dv ab71413
Support fileName in Vue
igor-dv ba02cc8
Merge branch 'master' into 887-generate-snapshot-per-story-file
igor-dv 6bf56cb
Merge branch 'master' into 887-generate-snapshot-per-story-file
igor-dv e83b2fd
Merge branch 'master' into 887-generate-snapshot-per-story-file
ndelangen 54cb5d1
Merge branch 'master' into 887-generate-snapshot-per-story-file
igor-dv 70c2ebe
Merge branch 'master' into 887-generate-snapshot-per-story-file
igor-dv 9b815a0
Merge branch 'master' into 887-generate-snapshot-per-story-file
96a389b
Merge branch 'master' into 887-generate-snapshot-per-story-file
ndelangen 571373d
Merge branch 'release/3.3' into 887-generate-snapshot-per-story-file
ndelangen 7de3acc
Merge branch 'release/3.3' into 887-generate-snapshot-per-story-file
igor-dv be9ab35
Merge branch 'release/3.3' into 887-generate-snapshot-per-story-file
ndelangen 8e87fb8
CHANGE path of the snapshots files into the regular `__snapshots__` f…
ndelangen af02e15
CHANGE storyshots on cra-kitchen-sink to use this new feature
ndelangen fd3d5e5
CLEANUP reduce noise in unit tests
ndelangen 07146a8
Merge branch 'release/3.3' into 887-generate-snapshot-per-story-file
shilman 66c0d09
Document new option in README
shilman 91e0105
Merge branch 'release/3.3' into 887-generate-snapshot-per-story-file
ndelangen 6496454
Add integrity test to check if every .storyshot file has its story file
igor-dv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
addons/storyshots/stories/directly_required/__snapshots__/index.storyshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots Another Button with some emoji 1`] = ` | ||
<button | ||
className="css-1yjiefr" | ||
onClick={[Function]} | ||
> | ||
😀 😎 👍 💯 | ||
</button> | ||
`; | ||
|
||
exports[`Storyshots Another Button with text 1`] = ` | ||
<button | ||
className="css-1yjiefr" | ||
onClick={[Function]} | ||
> | ||
Hello Button | ||
</button> | ||
`; |
19 changes: 19 additions & 0 deletions
19
addons/storyshots/stories/required_with_context/__snapshots__/Button.stories.storyshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots Button with some emoji 1`] = ` | ||
<button | ||
className="css-1yjiefr" | ||
onClick={[Function]} | ||
> | ||
😀 😎 👍 💯 | ||
</button> | ||
`; | ||
|
||
exports[`Storyshots Button with text 1`] = ` | ||
<button | ||
className="css-1yjiefr" | ||
onClick={[Function]} | ||
> | ||
Hello Button | ||
</button> | ||
`; |
104 changes: 104 additions & 0 deletions
104
addons/storyshots/stories/required_with_context/__snapshots__/Welcome.stories.storyshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots Welcome to Storybook 1`] = ` | ||
<article | ||
className="css-1fqbdip" | ||
> | ||
<h1 | ||
className="css-nil" | ||
> | ||
Welcome to storybook | ||
</h1> | ||
<p> | ||
This is a UI component dev environment for your app. | ||
</p> | ||
<p> | ||
We've added some basic stories inside the | ||
|
||
<code | ||
className="css-mteq83" | ||
> | ||
src/stories | ||
</code> | ||
|
||
directory. | ||
<br /> | ||
A story is a single state of one or more UI components. You can have as many stories as you want. | ||
<br /> | ||
(Basically a story is like a visual test case.) | ||
</p> | ||
<p> | ||
See these sample | ||
|
||
<a | ||
className="css-ca0824" | ||
onClick={[Function]} | ||
role="button" | ||
tabIndex="0" | ||
> | ||
stories | ||
</a> | ||
|
||
for a component called | ||
|
||
<code | ||
className="css-mteq83" | ||
> | ||
Button | ||
</code> | ||
. | ||
</p> | ||
<p> | ||
Just like that, you can add your own components as stories. | ||
<br /> | ||
You can also edit those components and see changes right away. | ||
<br /> | ||
(Try editing the | ||
<code | ||
className="css-mteq83" | ||
> | ||
Button | ||
</code> | ||
stories located at | ||
<code | ||
className="css-mteq83" | ||
> | ||
src/stories/index.js | ||
</code> | ||
.) | ||
</p> | ||
<p> | ||
Usually we create stories with smaller UI components in the app. | ||
<br /> | ||
Have a look at the | ||
|
||
<a | ||
className="css-ca0824" | ||
href="https://storybook.js.org/basics/writing-stories" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
Writing Stories | ||
</a> | ||
|
||
section in our documentation. | ||
</p> | ||
<p | ||
className="css-bwdon3" | ||
> | ||
<b> | ||
NOTE: | ||
</b> | ||
<br /> | ||
Have a look at the | ||
|
||
<code | ||
className="css-mteq83" | ||
> | ||
.storybook/webpack.config.js | ||
</code> | ||
|
||
to add webpack loaders and plugins you are using in this project. | ||
</p> | ||
</article> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import path from 'path'; | ||
import initStoryshots, { multiSnapshotWithOptions } from '../src'; | ||
|
||
initStoryshots({ | ||
framework: 'react', | ||
configPath: path.join(__dirname, '..', '.storybook'), | ||
test: multiSnapshotWithOptions({}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hmmm @ndelangen @igor-dv @tmeasday is this actually an improvement? I think I liked it better before...
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 don't know how to feel about it.. Even though it's a "default" Jest behavior I would like to see
.storyshots
here (I like the webstrom grouping feature 😄):Maybe let's make it configurable (@ndelangen don't burn me 😈) ?
Nevertheless I want to add a test as part of the Storyshots that will check if every
.storyshot
file has its story file (Like jest does with the.snap
files)