- Added Vitest as a dependency for improved testing capabilities. - Updated package.json with new test scripts for running tests, watching, and coverage reporting. - Configured ESLint to recognize test runner scripts and included them in the linting process. - Modified tsconfig.json to include Vitest types for better TypeScript support in tests.
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import path from 'path';
|
|
|
|
// Solution: créer un mock de postcss.config.mjs pour les tests
|
|
// En renommant temporairement le fichier ou en créant une config vide
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
globals: true,
|
|
environment: 'node',
|
|
include: ['src/**/__tests__/**/*.test.ts'],
|
|
setupFiles: ['./src/services/__tests__/setup.ts'],
|
|
// Afficher plus de détails dans la sortie
|
|
reporters: ['verbose'],
|
|
// Afficher les tests qui passent aussi
|
|
silent: false,
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'json', 'html'],
|
|
exclude: [
|
|
'node_modules/',
|
|
'src/**/__tests__/**',
|
|
'**/*.config.*',
|
|
'**/dist/**',
|
|
],
|
|
// Afficher les fichiers non couverts
|
|
reportOnFailure: true,
|
|
// Afficher plus de détails
|
|
all: false,
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
// Désactiver le traitement CSS pour éviter PostCSS
|
|
// Le fichier postcss.config.mjs est renommé par le script test-runner.js
|
|
css: {
|
|
modules: {
|
|
localsConvention: 'camelCase',
|
|
},
|
|
},
|
|
});
|