docs/_snippets/automock-register-full.md
// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, vue3-vite, sveltekit)
import type { Preview } from '@storybook/your-framework';
import { sb } from 'storybook/test';
// ๐ Automatically replaces all exports from the `lib/session` local module with mock functions
sb.mock(import('../lib/session.ts'));
// ๐ Automatically replaces all exports from the `uuid` package in `node_modules` with mock functions
sb.mock(import('uuid'));
const preview: Preview = {
// ...
};
export default preview;
import { sb } from 'storybook/test';
// ๐ Automatically replaces all exports from the `lib/session` local module with mock functions
sb.mock('../lib/session.js');
// ๐ Automatically replaces all exports from the `uuid` package in `node_modules` with mock functions
sb.mock('uuid');
export default {
// ...
};
// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite)
import { definePreview } from '@storybook/your-framework';
import { sb } from 'storybook/test';
// ๐ Automatically replaces all exports from the `lib/session` local module with mock functions
sb.mock(import('../lib/session.ts'));
// ๐ Automatically replaces all exports from the `uuid` package in `node_modules` with mock functions
sb.mock(import('uuid'));
export default definePreview({
// ...
});
// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite)
import { definePreview } from '@storybook/your-framework';
import { sb } from 'storybook/test';
// ๐ Automatically replaces all exports from the `lib/session` local module with mock functions
sb.mock('../lib/session.js');
// ๐ Automatically replaces all exports from the `uuid` package in `node_modules` with mock functions
sb.mock('uuid');
export default definePreview({
// ...
});
import { definePreview } from '@storybook/vue3-vite';
import { sb } from 'storybook/test';
// ๐ Automatically replaces all exports from the `lib/session` local module with mock functions
sb.mock(import('../lib/session.ts'));
// ๐ Automatically replaces all exports from the `uuid` package in `node_modules` with mock functions
sb.mock(import('uuid'));
export default definePreview({
// ...
});
import { definePreview } from '@storybook/vue3-vite';
import { sb } from 'storybook/test';
// ๐ Automatically replaces all exports from the `lib/session` local module with mock functions
sb.mock('../lib/session.js');
// ๐ Automatically replaces all exports from the `uuid` package in `node_modules` with mock functions
sb.mock('uuid');
export default definePreview({
// ...
});
import { definePreview } from '@storybook/angular';
import { sb } from 'storybook/test';
// ๐ Automatically replaces all exports from the `lib/session` local module with mock functions
sb.mock(import('../lib/session.ts'));
// ๐ Automatically replaces all exports from the `uuid` package in `node_modules` with mock functions
sb.mock(import('uuid'));
export default definePreview({
// ...
});
import { definePreview } from '@storybook/web-components-vite';
import { sb } from 'storybook/test';
// ๐ Automatically replaces all exports from the `lib/session` local module with mock functions
sb.mock(import('../lib/session.ts'));
// ๐ Automatically replaces all exports from the `uuid` package in `node_modules` with mock functions
sb.mock(import('uuid'));
export default definePreview({
// ...
});
import { definePreview } from '@storybook/web-components-vite';
import { sb } from 'storybook/test';
// ๐ Automatically replaces all exports from the `lib/session` local module with mock functions
sb.mock('../lib/session.js');
// ๐ Automatically replaces all exports from the `uuid` package in `node_modules` with mock functions
sb.mock('uuid');
export default definePreview({
// ...
});