veza/apps/web/vitest.config.ts
senke ccc233e1ea fix(tests): cycles 12–18 – corrections services, mocks et design tokens
- chatService: getChannels → getServers
- commerceService: getOrders/getOrderDetails/getSalesStats → getPurchases/getSellerStats
- marketplaceService: mock réponse, params API, getDownloadLink → listOrders
- config/env.test: vi.stubEnv, import dynamique
- useAuth.test: mock useAuthStore
- TrackStatsDisplay, UploadQuota: mock du bon service (analyticsService, uploadService)
- TrackListEmpty, TrackListRow, TrackSearch: design tokens, assertions
- trackDownloadService, chunkedUploadService: MSW/server.use
- trackListService, trackSearchService, trackShareService: assertions
- ErrorBoundary, LoginForm, PlaylistErrorBoundary, PlaylistRecommendations
- RAPPORT_RESOLUTION_TESTS_CYCLE1.md

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 09:43:55 +01:00

185 lines
6.2 KiB
TypeScript

import { defineConfig, configDefaults } 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));
// 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)
'**/usePlaylistKeyboardShortcuts.test.ts', // Hook non implémenté (T0507)
'**/PlaylistVersionHistory.test.tsx', // Composant non implémenté (T0509)
'**/ShareLinkButton.test.tsx', // Composant non implémenté (T0488)
'**/PlaylistAccessibility.test.tsx', // Nécessite jest-axe (T0503)
'**/useRoutePreload-additional.test.ts', // Incompatibilité fake timers + renderHook
],
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'),
},
},
});