unit tests fixin
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 41s

This commit is contained in:
2025-11-22 00:17:05 -08:00
parent d13672533d
commit 97bb1a3966
14 changed files with 260 additions and 650 deletions

View File

@@ -1,40 +1,18 @@
// vite.config.ts
/// <reference types="vitest" />
import path from 'path';
import { defineConfig as defineViteConfig } from 'vite';
import { defineConfig as defineVitestConfig } from 'vitest/config';
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
console.log('--- [EXECUTION PROOF] vite.config.ts is being loaded. ---');
const vitestConfig = defineVitestConfig({
test: {
environment: 'jsdom',
// Use our new global setup file.
globalSetup: './src/tests/setup/global-setup.ts',
setupFiles: ['./src/vitest.setup.ts'],
coverage: {
provider: 'v8', // or 'istanbul'
// Reporters to use. 'text' will show a summary in the console.
// 'html' will generate a full report in the directory specified below.
reporter: ['text', 'html'],
reportsDirectory: './coverage',
include: ['src/**/*.{ts,tsx}'], // This now correctly includes all src files for coverage analysis.
// Exclude files that are not relevant for coverage.
exclude: [
'src/main.tsx', 'src/vite-env.d.ts', 'src/types.ts', 'src/vitest.setup.ts',
'src/**/*.test.{ts,tsx}', 'src/components/icons', 'src/services/logger.ts', 'src/services/notificationService.ts'
],
}
},
});
const viteConfig = defineViteConfig({
/**
* This is the main configuration file for Vite and the Vitest 'unit' test project.
* When running `vitest`, it is orchestrated by `vitest.workspace.ts`, which
* separates the unit and integration test environments.
*/
export default defineConfig({
// Vite-specific configuration for the dev server, build, etc.
// This is inherited by all Vitest projects.
plugins: [react()],
// No explicit 'css' block. Let Vite do its job.
server: {
port: 3000,
host: '0.0.0.0',
@@ -42,8 +20,26 @@ const viteConfig = defineViteConfig({
resolve: {
alias: {
'@': path.resolve(process.cwd(), './src'),
}
},
},
});
export default { ...viteConfig, test: vitestConfig.test };
// Vitest-specific configuration for the 'unit' test project.
test: {
// The name for this project is defined by the filename in the workspace config.
environment: 'jsdom',
globalSetup: './src/tests/setup/global-setup.ts',
setupFiles: ['./src/vitest.setup.ts'],
// Exclude integration tests, which are handled by a separate project.
exclude: ['**/*.integration.test.ts', '**/node_modules/**'],
coverage: {
provider: 'v8',
reporter: ['text', 'html'],
reportsDirectory: './coverage',
include: ['src/**/*.{ts,tsx}'],
exclude: [
'src/main.tsx', 'src/vite-env.d.ts', 'src/types.ts', 'src/vitest.setup.ts',
'src/**/*.test.{ts,tsx}', 'src/components/icons', 'src/services/logger.ts', 'src/services/notificationService.ts'
],
},
},
});