-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
info addon and storyshot seem to be incompatible #1011
Comments
I have updated to the new storyshots and have configured the Storyshots.test.js file like this: import initStoryshots from 'storyshots'
initStoryshots() I added the I then find that the error is back again: {
"presets": [
"react-app"
],
"plugins": [
"transform-class-properties",
],
"env": {
"development": {
"plugins": [
"import",
{
"libraryName": "antd",
"style": "css"
}
]
}
}
} I have this error again now: TypeError: (0 , _storybook.storiesOf)(...).addDecorator(...).addWithInfo is not a function
at Object.<anonymous> (src/form-schema/stories/ArrayType.story.js:69:1)
at node_modules/storyshots/dist/require_context.js:40:24
at Array.forEach (native)
at requireModules (node_modules/storyshots/dist/require_context.js:34:9)
at node_modules/storyshots/dist/require_context.js:49:7
at Array.forEach (native)
at requireModules (node_modules/storyshots/dist/require_context.js:34:9)
at node_modules/storyshots/dist/require_context.js:49:7
at Array.forEach (native)
at requireModules (node_modules/storyshots/dist/require_context.js:34:9)
at Function.newRequire.context (node_modules/storyshots/dist/require_context.js:92:5)
at evalmachine.<anonymous>:11:21
at runWithRequireContext (node_modules/storyshots/dist/require_context.js:104:3)
at testStorySnapshots (node_modules/storyshots/dist/index.js:72:35)
at Object.<anonymous> (src/form-schema/Storyshots.test.js:2:52) How can I get the new storyshots to work with info addon? Is there any workaround or is there any configuration for the issue. |
When reading the source, I found that import {Story as Info} from '@kadira/react-storybook-addon-info'
storiesOf('MyComponent', module)
.add('my component is amazing', context => {
const myCompProps = {a: 'b'}
const info = `This string can get really long`
return (
<Info
info={info}
context={context}
showInline
propTables={[MyComponent]}
styles={s => s}
<MyComponent {...myCompProps} />
</Info>
)
}) A few things are still giving me trouble though: The |
Thanks for the report @vamsiampolu. We should get rid of the In terms of your second problem, I agree it's an issue with all decorators. It's something we'd like to solve as part of a new addon API #1212 |
@tmeasday @vamsiampolu see also #1147 |
Adding this to our
|
#1147 info will be moved into a panel And we have a solution: |
If you use the latest // storybook.test.js
import initStoryshots from '@storybook/addon-storyshots';
const addonInfo = require('@storybook/addon-info');
addonInfo.withInfo = () => storyFn => storyFn;
initStoryshots(); Looking forward to #1147 ! |
Thank for the additional help @MrOrz |
FYI, you can use jest to mock the // package.json
"setupTestFrameworkScriptFile": "<rootDir>/setupTests.js",
// setupTests.js
jest.mock('@storybook/addon-info', () => ({
withInfo: () => storyFn => storyFn,
setDefaults: () => {},
}));
// Component.story.js
import { withInfo } from '@storybook/addon-info';
storiesOf('Component', module).add(
'title',
withInfo({
text: 'text',
inline: true,
})(() => (
<Component>
<div>item 1</div>
</Component>
)),
); |
Fixed "info addon and storyshot seem to be incompatible" storybookjs/storybook#1011
I am having trouble getting storyshots to work when using the
info
addon, when I try and run storyshots, it gives me the error:I am using an ejected create-react-app, the
.babelrc
looks like:My configuration looks like this:
The webpack configuration for storybook looks like this:
Is there a workaround for using these two plugins together.
The text was updated successfully, but these errors were encountered: