storybook/docs/_snippets/portable-stories-vitest-override-set-project-annotations.md
2024-07-09 19:20:36 +02:00

1.9 KiB

import { beforeAll } from 'vitest';
import { render as testingLibraryRender } from '@testing-library/react';
import { setProjectAnnotations } from '@storybook/react';
import * as addonAnnotations from 'my-addon/preview';
import * as previewAnnotations from './.storybook/preview';

const annotations = setProjectAnnotations([
  previewAnnotations,
  addonAnnotations,
  // Attention: Passing the render function from testing library is required if you mount stories in play functions
  { testingLibraryRender },
]);

// Supports beforeAll hook from Storybook
beforeAll(annotations.beforeAll);
import { beforeAll } from 'vitest';
import { render as testingLibraryRender } from '@testing-library/svelte';
import { setProjectAnnotations } from '@storybook/svelte';
import * as addonAnnotations from 'my-addon/preview';
import * as previewAnnotations from './.storybook/preview';

const annotations = setProjectAnnotations([
  previewAnnotations,
  addonAnnotations,
  // Attention: Passing the render function from testing library is required if you mount stories in play functions
  { testingLibraryRender },
]);

// Supports beforeAll hook from Storybook
beforeAll(annotations.beforeAll);
import { beforeAll } from 'vitest';
import { render as testingLibraryRender } from '@testing-library/vue';
import { setProjectAnnotations } from '@storybook/vue3';
import * as addonAnnotations from 'my-addon/preview';
import * as previewAnnotations from './.storybook/preview';

const annotations = setProjectAnnotations([
  previewAnnotations,
  addonAnnotations,
  // Attention: Passing the render function from testing library is required if you mount stories in play functions
  { testingLibraryRender },
]);

// Supports beforeAll hook from Storybook
beforeAll(annotations.beforeAll);