docs/_snippets/automock-register-mock-file.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';
// ๐ Replaces imports of this module with imports to `../lib/__mocks__/session.ts`
sb.mock(import('../lib/session.ts'));
// ๐ Replaces imports of this module with imports to `../__mocks__/uuid.ts`
sb.mock(import('uuid'));
const preview: Preview = {
// ...
};
export default preview;
import { sb } from 'storybook/test';
// ๐ Replaces imports of this module with imports to `../lib/__mocks__/session.ts`
sb.mock('../lib/session.js');
// ๐ Replaces imports of this module with imports to `../__mocks__/uuid.ts`
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';
// ๐ Replaces imports of this module with imports to `../lib/__mocks__/session.ts`
sb.mock(import('../lib/session.ts'));
// ๐ Replaces imports of this module with imports to `../__mocks__/uuid.ts`
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';
// ๐ Replaces imports of this module with imports to `../lib/__mocks__/session.ts`
sb.mock('../lib/session.js');
// ๐ Replaces imports of this module with imports to `../__mocks__/uuid.ts`
sb.mock('uuid');
export default definePreview({
// ...
});
import { definePreview } from '@storybook/vue3-vite';
import { sb } from 'storybook/test';
// ๐ Replaces imports of this module with imports to `../lib/__mocks__/session.ts`
sb.mock(import('../lib/session.ts'));
// ๐ Replaces imports of this module with imports to `../__mocks__/uuid.ts`
sb.mock(import('uuid'));
export default definePreview({
// ...
});
import { definePreview } from '@storybook/vue3-vite';
import { sb } from 'storybook/test';
// ๐ Replaces imports of this module with imports to `../lib/__mocks__/session.ts`
sb.mock('../lib/session.js');
// ๐ Replaces imports of this module with imports to `../__mocks__/uuid.ts`
sb.mock('uuid');
export default definePreview({
// ...
});
import { definePreview } from '@storybook/angular';
import { sb } from 'storybook/test';
// ๐ Replaces imports of this module with imports to `../lib/__mocks__/session.ts`
sb.mock(import('../lib/session.ts'));
// ๐ Replaces imports of this module with imports to `../__mocks__/uuid.ts`
sb.mock(import('uuid'));
export default definePreview({
// ...
});
import { definePreview } from '@storybook/web-components-vite';
import { sb } from 'storybook/test';
// ๐ Replaces imports of this module with imports to `../lib/__mocks__/session.ts`
sb.mock(import('../lib/session.ts'));
// ๐ Replaces imports of this module with imports to `../__mocks__/uuid.ts`
sb.mock(import('uuid'));
export default definePreview({
// ...
});
import { definePreview } from '@storybook/web-components-vite';
import { sb } from 'storybook/test';
// ๐ Replaces imports of this module with imports to `../lib/__mocks__/session.ts`
sb.mock('../lib/session.js');
// ๐ Replaces imports of this module with imports to `../__mocks__/uuid.ts`
sb.mock('uuid');
export default definePreview({
// ...
});