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

Related issues

ZigGreen picture ZigGreen  路  3Comments

levithomason picture levithomason  路  3Comments

shilman picture shilman  路  3Comments

arunoda picture arunoda  路  3Comments

tlrobinson picture tlrobinson  路  3Comments