Storybook: Mocking in storyshots

Created on 26 Apr 2017  ·  2Comments  ·  Source: storybookjs/storybook

Is it possible to Mock components when using storyshots? I can't see any documentation to do it.

question / support

Most helpful comment

Yes, it is possible. I mock several components for storyshots with Jest config:

"setupFiles": [
  "<rootDir>/.storybook/storyshots-setup.js"
],
// .storybook/storyshots-setup.js"
jest.mock('react-motion-ui-pack');
...

Reference: https://github.com/MCS-Lite/mcs-lite/blob/master/packages/mcs-lite-ui/package.json#L30

All 2 comments

Yes, it is possible. I mock several components for storyshots with Jest config:

"setupFiles": [
  "<rootDir>/.storybook/storyshots-setup.js"
],
// .storybook/storyshots-setup.js"
jest.mock('react-motion-ui-pack');
...

Reference: https://github.com/MCS-Lite/mcs-lite/blob/master/packages/mcs-lite-ui/package.json#L30

Awesome, thanks!

Was this page helpful?
0 / 5 - 0 ratings