Last active
September 26, 2021 11:12
-
-
Save ahayes91/89f8d9cfc5a0c59ec3d99cfa8d670daa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { addDecorator } from '@storybook/react'; | |
import { initializeWorker, mswDecorator } from 'msw-storybook-addon'; | |
import getConfigForCurrentEnv from 'get-env-config'; | |
import { getEnvironment } from 'get-environment'; | |
import { userContextDecorator } from '../__mocks__/auth'; | |
const { storyBook } = getConfigForCurrentEnv(); | |
const env = getEnvironment(); | |
// Only use Mock Service Worker when we are running locally for now | |
if (env === 'local' || env === 'development') { | |
initializeWorker({ | |
serviceWorker: { | |
// Points to the custom location of the Service Worker file. | |
url: `${storyBook}mockServiceWorker.js`, | |
}, | |
}); | |
addDecorator(mswDecorator); | |
addDecorator(userContextDecorator); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment