Skip to content

Commit aa45428

Browse files
committed
chore(vitest): move test config to vite config
1 parent d767bec commit aa45428

File tree

2 files changed

+26
-30
lines changed

2 files changed

+26
-30
lines changed

vite.config.mts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
4+
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
15
import react from '@vitejs/plugin-react-swc';
26
import type { UserConfig } from 'vite';
37

8+
const dirname = path.dirname(fileURLToPath(import.meta.url));
9+
410
const config: UserConfig = {
511
plugins: [
612
react({
@@ -16,6 +22,26 @@ const config: UserConfig = {
1622
'@chakra-ui/react/styled-system',
1723
],
1824
},
25+
test: {
26+
projects: [
27+
{
28+
extends: true,
29+
plugins: [
30+
storybookTest({ configDir: path.join(dirname, '.storybook') }),
31+
],
32+
test: {
33+
name: 'storybook',
34+
browser: {
35+
enabled: true,
36+
headless: true,
37+
provider: 'playwright',
38+
instances: [{ browser: 'chromium' }],
39+
},
40+
setupFiles: ['.storybook/vitest.setup.ts'],
41+
},
42+
},
43+
],
44+
},
1945
};
2046

2147
export { config as default };

vitest.config.mts

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)