Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
shajz committed Nov 16, 2022
1 parent c81038e commit f7f8fc9
Show file tree
Hide file tree
Showing 4 changed files with 67,239 additions and 67,210 deletions.
2 changes: 1 addition & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
staticDirs: ['./public'],
staticDirs: [{ from: './public', to: '/storybook' }],
addons: ['@storybook/addon-essentials', '@storybook/addon-a11y'],
core: {
builder: 'webpack5',
Expand Down
14 changes: 9 additions & 5 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { setCompodocJson } from '@storybook/addon-docs/angular';
import docJson from './documentation.json';

import { initialize, mswDecorator } from 'msw-storybook-addon';

const docToCleanup = [...docJson.components, ...docJson.directives, ...docJson.pipes];

for (const doc of docToCleanup) {
Expand Down Expand Up @@ -50,9 +52,11 @@ export const parameters = {
// and a story's runtime (browser). However, we cannot call `setupWorker`
// in Node environment, so need to check if we're in a browser.
if (typeof global.process === 'undefined') {
const { worker } = require('./msw/browser');
// Start the mocking when each story is loaded.
// Repetitive calls to the `.start()` method do not register a new worker,
// but check whether there's an existing once, reusing it, if so.
worker.start();
// Initialize MSW
initialize({
serviceWorker: {
url: '/storybook/mockServiceWorker.js',
},
});
}
export const decorators = [mswDecorator];
Loading

0 comments on commit f7f8fc9

Please sign in to comment.