You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! thanks for your work on this library! I have been having some issues with inconsistent mocking when running Jest tests (with portable stories) locally vs in CI. Currently, I use .load() to load the msw loaders in test.
Here's my storybook preview:
importtype{Preview}from'@storybook/react';import{initialize,mswLoader}from'msw-storybook-addon';import{initialHandlers}from'../src/utils/msw/initialHandlers';initialize({onUnhandledRequest: 'bypass',},// initial handlers required by the app[...initialHandlers]);constpreview: Preview={parameters: {controls: {expanded: true,},},loaders: [mswLoader],};exportdefaultpreview;
It is possible that I have not set up the project annotations correctly as the doc states, but it will be useful to know what "correctly" means here.
Additionally, when you have the time, it would be awesome to have a simple example of how the ideal Storybook addon + Jest test setup should look like. Thank you once again!
The text was updated successfully, but these errors were encountered:
Hi! thanks for your work on this library! I have been having some issues with inconsistent mocking when running Jest tests (with portable stories) locally vs in CI. Currently, I use
.load()
to load the msw loaders in test.Here's my storybook preview:
And here's my
setupTests
:When running tests:
but the
.play()
above does not work - it is not defined.load()
is defined, butplay()
is not. According to the library docs here → https://github.com/mswjs/msw-storybook-addon?tab=readme-ov-file#storybook-82-or-higher, we should useplay()
- but this function is not defined for some reason.It is possible that I have not set up the project annotations correctly as the doc states, but it will be useful to know what "correctly" means here.
Additionally, when you have the time, it would be awesome to have a simple example of how the ideal Storybook addon + Jest test setup should look like. Thank you once again!
The text was updated successfully, but these errors were encountered: