veza/apps/web/vitest.config.ts
senke ae586f6134 Phase 2 stabilisation: code mort, Modal→Dialog, feature flags, tests, router split, Rust legacy
Bloc A - Code mort:
- Suppression Studio (components, views, features)
- Suppression gamification + services mock (projectService, storageService, gamificationService)
- Mise à jour Sidebar, Navbar, locales

Bloc B - Frontend:
- Suppression modal.tsx deprecated, Modal.stories (doublon Dialog)
- Feature flags: PLAYLIST_SEARCH, PLAYLIST_RECOMMENDATIONS, ROLE_MANAGEMENT = true
- Suppression 19 tests orphelins, retrait exclusions vitest.config

Bloc C - Backend:
- Extraction routes_auth.go depuis router.go

Bloc D - Rust:
- Suppression security_legacy.rs (code mort, patterns déjà dans security/)
2026-02-14 17:23:32 +01:00

190 lines
6.1 KiB
TypeScript

import { defineConfig, configDefaults } from 'vitest/config';
import react from '@vitejs/plugin-react';
import path from 'path';
import { fileURLToPath } from 'node:url';
// Storybook test plugin — uncomment storybookTest and the browser project below
// to run story-based visual tests (requires Playwright to be installed).
// import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
const dirname =
typeof __dirname !== 'undefined'
? __dirname
: path.dirname(fileURLToPath(import.meta.url));
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
export default defineConfig({
plugins: [react()],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts', './src/mocks/test-setup.ts'],
exclude: [
...configDefaults.exclude,
'**/e2e/**', // Playwright E2E tests (run via playwright test)
],
pool: 'threads',
poolOptions: {
threads: {
maxThreads: 2,
minThreads: 1,
},
},
fileParallelism: false,
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/',
'src/test/',
'**/*.d.ts',
'**/*.config.*',
'**/coverage/**',
'**/dist/**',
'**/.{idea,git,cache,output,temp}/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
],
thresholds: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
},
// projects: [
// {
// extends: true,
// plugins: [
// // The plugin will run tests for the stories defined in your Storybook config
// // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
// // storybookTest({
// // configDir: path.join(dirname, '.storybook'),
// // }),
// ],
// test: {
// name: 'storybook',
// browser: {
// enabled: true,
// headless: true,
// provider: 'playwright',
// instances: [
// {
// browser: 'chromium',
// },
// ],
// },
// setupFiles: ['.storybook/vitest.setup.ts'],
// },
// },
// {
// extends: true,
// plugins: [
// // The plugin will run tests for the stories defined in your Storybook config
// // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
// // storybookTest({
// // configDir: path.join(dirname, '.storybook'),
// // }),
// ],
// test: {
// name: 'storybook',
// browser: {
// enabled: true,
// headless: true,
// provider: 'playwright',
// instances: [
// {
// browser: 'chromium',
// },
// ],
// },
// setupFiles: ['.storybook/vitest.setup.ts'],
// },
// },
// {
// extends: true,
// plugins: [
// // The plugin will run tests for the stories defined in your Storybook config
// // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
// // storybookTest({
// // configDir: path.join(dirname, '.storybook'),
// // }),
// ],
// test: {
// name: 'storybook',
// browser: {
// enabled: true,
// headless: true,
// provider: 'playwright',
// instances: [
// {
// browser: 'chromium',
// },
// ],
// },
// setupFiles: ['.storybook/vitest.setup.ts'],
// },
// },
// {
// extends: true,
// plugins: [
// // The plugin will run tests for the stories defined in your Storybook config
// // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
// // storybookTest({
// // configDir: path.join(dirname, '.storybook'),
// // }),
// ],
// test: {
// name: 'storybook',
// browser: {
// enabled: true,
// headless: true,
// provider: 'playwright',
// instances: [
// {
// browser: 'chromium',
// },
// ],
// },
// setupFiles: ['.storybook/vitest.setup.ts'],
// },
// },
// {
// extends: true,
// plugins: [
// // The plugin will run tests for the stories defined in your Storybook config
// // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
// // storybookTest({
// // configDir: path.join(dirname, '.storybook'),
// // }),
// ],
// test: {
// name: 'storybook',
// browser: {
// enabled: true,
// headless: true,
// provider: 'playwright',
// instances: [
// {
// browser: 'chromium',
// },
// ],
// },
// setupFiles: ['.storybook/vitest.setup.ts'],
// },
// },
// ],
},
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'),
},
},
});