-
-
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
Storyshots does not render JSX in addDecorator #9771
Comments
@david-golightly-leapyear It looks to me like it actually recommends using |
@shilman That’s correct. The linked repo uses the |
My question was about the inconsistency comment. It doesn't seem inconsistent to me, but maybe I'm missing something? I want to fix it if it's inconsistent 😄 |
The resolution to #3246 recommends ensuring |
Gotcha. Thanks for clarifying! cc @ndelangen |
Confirmed - all of our stories rely on a |
We're going to have to inspect the load order of preview.js in storyshots. In the repro I see there's a |
In the meantime, is there any other way to add a decorator? I'm using the following to get addSerializer(styleSheetSerializer);
initStoryshots({
test: ({story, context}) => {
const snapshotFilename = path.join(
`__snapshots__/${context.kind}.storysnaps`
);
const storyElement = story.render(context);
const tree = renderer.create(storyElement).toJSON();
expect(tree).toMatchSpecificSnapshot(snapshotFilename);
}
}); |
@ndelangen pretty sure there's support for |
@ndelangen @shilman I can confirm that changing const { addDecorator } = require('@storybook/react')
const React = require('react')
addDecorator((content) => (
React.createElement('div', { children: ['Preview Decorator', content()]})
)) This is sort of a workaround, but represents a significant behavioral regression from 5.2. Especially more complex React layouts will be tedious to implement in this way. |
Looks like there are a couple bugs here @ndelangen:
Can we just add support for [.tsx,.ts,.jsx,.js] across the board, in a simple find call? |
@david-golightly-leapyear would you happen to have some time to fix this issue? @shilman has pointed out the correct place for the fix. 🙇 |
@ndelangen @shilman Submitted #9834 for your review. |
Ermahgerd!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-alpha.13 containing PR #9834 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. |
Yowza!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.14 containing PR #9834 that references this issue. Upgrade today to try it out! |
Describe the bug
addDecorator
fromstorybook/react
does not appear to be called in storyshots, even though it's called in Storybook itself.[EDIT] This appears to be the case only in .jsx and .tsx files.
To Reproduce
Minimal repro can be found at this repository:
https://github.com/LeapYear/storybook-storyshots-repro
Expected behavior
addDecorator
should be called with storyshotsPossibly related issues
#3246
require
calls fromconfig.js
tomain.js
, leavingaddDecorator
in place. However, the documentation for@storybook/react
still recommends usingconfigure(require.context(..), ..)
. Is the documentation inconsistent?The text was updated successfully, but these errors were encountered: