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 exclude: ['e2e/**'],
26 server: {
27 deps: {
28 // Mantine and react-icons publish ESM that references browser globals;
29 // inlining them ensures Vitest transforms them for the jsdom environment.
30 inline: [
31 '@mantine/code-highlight',
32 '@mantine/core',
33 '@mantine/dates',
34 '@mantine/dropzone',
35 '@mantine/form',
36 '@mantine/hooks',
37 '@mantine/modals',
38 '@mantine/notifications',
39 'react-icons',
40 ],
41 },
42 },
43 },
44 },
45 {
46 extends: true,
47 plugins: [
48 // The plugin will run tests for the stories defined in your Storybook config
49 // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
50 storybookTest({
51 configDir: path.join(dirname, '.storybook'),
52 }),
53 ],
54 test: {
55 name: 'storybook',
56 browser: {
57 enabled: true,
58 headless: true,
59 provider: playwright({}),
60 instances: [
61 {
62 browser: 'chromium',
63 },
64 ],
65 },
66 },
67 },
68 ],
69 },
70});