This repository has no description
1import { defineConfig } from 'vitest/config';
2import react from '@vitejs/plugin-react';
3import path from 'node:path';
4import { fileURLToPath } from 'node:url';
5import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
6import { playwright } from '@vitest/browser-playwright';
7const dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
8
9// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
10export default defineConfig({
11 plugins: [react()],
12 resolve: {
13 tsconfigPaths: true
14 },
15 test: {
16 projects: [{
17 extends: true,
18 test: {
19 environment: 'jsdom',
20 include: ['**/*.{test,spec}.{ts,tsx}'],
21 server: {
22 deps: {
23 // Mantine and react-icons publish ESM that references browser globals;
24 // inlining them ensures Vitest transforms them for the jsdom environment.
25 inline: ['@mantine/code-highlight', '@mantine/core', '@mantine/dates', '@mantine/dropzone', '@mantine/form', '@mantine/hooks', '@mantine/modals', '@mantine/notifications', 'react-icons']
26 }
27 }
28 }
29 }, {
30 extends: true,
31 plugins: [
32 // The plugin will run tests for the stories defined in your Storybook config
33 // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
34 storybookTest({
35 configDir: path.join(dirname, '.storybook')
36 })],
37 test: {
38 name: 'storybook',
39 browser: {
40 enabled: true,
41 headless: true,
42 provider: playwright({}),
43 instances: [{
44 browser: 'chromium'
45 }]
46 }
47 }
48 }]
49 }
50});