feat(tests): integrate Vitest for testing framework and add test scripts
- 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.
This commit is contained in:
44
vitest.config.ts
Normal file
44
vitest.config.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
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',
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user