49 lines
1.5 KiB
JavaScript
Executable File
49 lines
1.5 KiB
JavaScript
Executable File
// vite.config.js
|
|
/// <reference types="vitest/config" />
|
|
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin'
|
|
import { playwright } from '@vitest/browser-playwright'
|
|
|
|
const dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
base: '/',
|
|
test: {
|
|
projects: [
|
|
{
|
|
extends: true,
|
|
plugins: [
|
|
storybookTest({
|
|
configDir: path.join(dirname, '.storybook'),
|
|
}),
|
|
],
|
|
test: {
|
|
name: 'storybook',
|
|
browser: {
|
|
enabled: true,
|
|
headless: true,
|
|
provider: playwright({}),
|
|
instances: [{ browser: 'chromium' }],
|
|
},
|
|
setupFiles: ['.storybook/vitest.setup.js'],
|
|
},
|
|
},
|
|
{
|
|
test: {
|
|
name: 'unit',
|
|
include: [
|
|
'src/**/*.test.js',
|
|
'src/**/*.test.ts',
|
|
'utils/**/*.test.js',
|
|
],
|
|
environment: 'node',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
})
|