chore: add vitest storybook config generated by pre-commit hook
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9c305b2612
commit
074e8fd3a1
1 changed files with 51 additions and 0 deletions
51
apps/web/vitest.storybook.config.ts
Normal file
51
apps/web/vitest.storybook.config.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
import { defineConfig } from 'vitest/config';
|
||||||
|
import react from '@vitejs/plugin-react';
|
||||||
|
import path from 'path';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
||||||
|
|
||||||
|
const dirname =
|
||||||
|
typeof __dirname !== 'undefined'
|
||||||
|
? __dirname
|
||||||
|
: path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Separate vitest config for Storybook browser tests.
|
||||||
|
* Run with: npx vitest --config vitest.storybook.config.ts
|
||||||
|
*
|
||||||
|
* These tests run in a real browser (Playwright/Chromium) and cannot use
|
||||||
|
* msw/node or other Node-only setup files.
|
||||||
|
*/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
react(),
|
||||||
|
storybookTest({
|
||||||
|
configDir: path.join(dirname, '.storybook'),
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
test: {
|
||||||
|
name: 'storybook',
|
||||||
|
globals: true,
|
||||||
|
browser: {
|
||||||
|
enabled: true,
|
||||||
|
headless: true,
|
||||||
|
provider: 'playwright',
|
||||||
|
instances: [{ browser: 'chromium' }],
|
||||||
|
},
|
||||||
|
setupFiles: ['.storybook/vitest.setup.ts'],
|
||||||
|
include: ['src/**/*.stories.tsx'],
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': path.resolve(__dirname, './src'),
|
||||||
|
'@components': path.resolve(__dirname, './src/components'),
|
||||||
|
'@pages': path.resolve(__dirname, './src/pages'),
|
||||||
|
'@hooks': path.resolve(__dirname, './src/hooks'),
|
||||||
|
'@services': path.resolve(__dirname, './src/services'),
|
||||||
|
'@types': path.resolve(__dirname, './src/types'),
|
||||||
|
'@utils': path.resolve(__dirname, './src/utils'),
|
||||||
|
'@stores': path.resolve(__dirname, './src/stores'),
|
||||||
|
'@locales': path.resolve(__dirname, './src/locales'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue