-
-
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
CSF stories does not work correctly with addon-storyshots multiSnapshotWithOptions option #7697
Comments
@jrsearles Good catch cc @tmeasday |
🤔 I think CSF opens up the potential for refactoring how storyshots works in a much cleaner way (match on In the short term is there an easy fix to this problem? I don't think we actually know the file name any more -- we could add an optional |
Or maybe we do know the filename from the req? |
I think we can get the filename from the req as a workaround. |
I can contribute with some guidance. This bug will prevent us from switching to CSF format. |
Related: #7330 |
Unfortunately, it's possible only if first argument to |
Workaround: add
UPD: Until #8000 gets merged and released, you can also copy
This will add |
Ermahgerd!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.0-alpha.10 containing PR #8000 that references this issue. Upgrade today to try it out! You can find this prerelease on the Closing this issue. Please re-open if you think there's still more to do. |
Great Caesar's ghost!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.2.2 containing PR #8000 that references this issue. Upgrade today to try it out! |
@shilman @Hypnosphi I updated to 5.2.3 added:
Looks like the file is not included in the |
@mazikwyry Ugh, this file got filtered out of the publish. Sorry about that. I've fixed it here and will re-publish once it's merged: #8354 |
@mazikwyry Can you try |
I updated to It also doesn't work when I use a workaround |
@mazikwyry do you also have |
Yes I do // jest.config.js
...
transform: {
"^.+\.stories\.jsx?$": "@storybook/addon-storyshots/injectFileName",
"^.+\\.js$": "babel-jest",
},
...
Maybe there is something that I should change additionally for |
@mazikwyry Can you please create a GitHub repo with minimal reproduction of your issue? |
Describe the bug
I am trying out the beta for 5.2 and have converted several stories over to CSF. What i've found is that when running storyshots, all of the stories in the CSF style end up using the generic snapshot path/file instead of creating the snapshots adjacent to the stories.
To Reproduce
Steps to reproduce the behavior:
jest
with the storyshots add on enabled and the "--ci" flagExpected behavior
The story should use the same location as before to store snapshots.
Code snippets
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Binaries:
Node: 10.15.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.16.0 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.10.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
@storybook/addon-actions: 5.2.0-beta.23 => 5.2.0-beta.23
@storybook/addon-contexts: 5.2.0-beta.23 => 5.2.0-beta.23
@storybook/addon-docs: 5.2.0-beta.23 => 5.2.0-beta.23
@storybook/addon-knobs: 5.2.0-beta.23 => 5.2.0-beta.23
@storybook/addon-storyshots: 5.2.0-beta.23 => 5.2.0-beta.23
@storybook/addon-storyshots-puppeteer: 5.2.0-beta.23 => 5.2.0-beta.23
@storybook/addon-viewport: 5.2.0-beta.23 => 5.2.0-beta.23
@storybook/addons: 5.2.0-beta.23 => 5.2.0-beta.23
@storybook/preset-scss: ^1.0.2 => 1.0.2
@storybook/react: 5.2.0-beta.23 => 5.2.0-beta.23
@storybook/source-loader: 5.2.0-beta.23 => 5.2.0-beta.23
@storybook/theming: 5.2.0-beta.23 => 5.2.0-beta.23
Additional context
I did some tracing and the problem appears to be the the filename for the story is undefined when the snapshot is being validated. I've traced where the filename is being determined:
storybook/lib/client-api/src/client_api.ts
Line 187 in 0083afd
For CSF stories
m
istrue
here instead of an object. I believe the source may be this line here:storybook/lib/core/src/client/preview/start.js
Line 374 in b6282a8
The text was updated successfully, but these errors were encountered: