feat: add testing infrastructure and improve component feedback

- Added React testing setup with JSDOM
- Added component tests for AddTransactionForm and TransactionTable
- Improved error handling and success messages in components
- Updated test configuration and dependencies
- Added CSS for error and success states
This commit is contained in:
GitHub Copilot
2025-05-05 17:41:39 +00:00
parent d3855aa7e4
commit 7e5ed585f7
19 changed files with 1299 additions and 1096 deletions

View File

@@ -1,21 +1,27 @@
/// <reference types="vitest" />
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [react()],
test: {
// Increase timeout for slower CI environments
testTimeout: 10000,
// Use the setup file we created
// Ensure non-interactive and CI-friendly configuration
watch: false,
silent: false,
passWithNoTests: true,
teardownTimeout: 5000,
// Testing environment setup
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts'],
// Ensure we're using the right environment
environment: 'node',
// Only include test files
include: ['src/test/**/*.{test,spec}.{ts,js}'],
// Configure coverage collection
// Test file patterns
include: ['src/test/**/*.{test,spec}.{ts,tsx}'],
// Coverage configuration
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: ['node_modules/', 'src/test/**/*', '**/*.d.ts'],
},
// Global settings
globals: true,
},
});