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 =
8 typeof __dirname !== 'undefined'
9 ? __dirname
10 : path.dirname(fileURLToPath(import.meta.url));
11
12// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
13export default defineConfig({
14 plugins: [react()],
15 resolve: {
16 tsconfigPaths: true,
17 },
18 test: {
19 projects: [
20 {
21 extends: true,
22 test: {
23 environment: 'jsdom',
24 include: ['**/*.{test,spec}.{ts,tsx}'],
25 server: {
26 deps: {
27 // Mantine and react-icons publish ESM that references browser globals;
28 // inlining them ensures Vitest transforms them for the jsdom environment.
29 inline: [
30 '@mantine/code-highlight',
31 '@mantine/core',
32 '@mantine/dates',
33 '@mantine/dropzone',
34 '@mantine/form',
35 '@mantine/hooks',
36 '@mantine/modals',
37 '@mantine/notifications',
38 'react-icons',
39 ],
40 },
41 },
42 },
43 },
44 {
45 extends: true,
46 plugins: [
47 // The plugin will run tests for the stories defined in your Storybook config
48 // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
49 storybookTest({
50 configDir: path.join(dirname, '.storybook'),
51 }),
52 ],
53 test: {
54 name: 'storybook',
55 browser: {
56 enabled: true,
57 headless: true,
58 provider: playwright({}),
59 instances: [
60 {
61 browser: 'chromium',
62 },
63 ],
64 },
65 },
66 },
67 ],
68 },
69});