Files
flyer-crawler.projectium.com/vitest.config.integration.ts
Torben Sorensen f5d0e9cbe5
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 1m3s
upload file size limit increased in server.ts
2025-11-22 23:51:32 -08:00

41 lines
1.9 KiB
TypeScript

// vitest.config.integration.ts
import { defineConfig, mergeConfig } from 'vitest/config';
import viteConfig from './vite.config';
// 1. Separate the 'test' config (which has Unit Test exclusions)
// from the rest of the general Vite config (plugins, aliases, etc.)
// We cast to 'any' to avoid strict type checking on the import if necessary.
const { test: unitTestConfig, ...baseViteConfig } = viteConfig as any;
/**
* This configuration is specifically for integration tests.
* It MERGES with the main vite.config.ts to inherit plugins and aliases,
* then overrides the test-specific settings for a Node.js environment.
*/
export default mergeConfig(viteConfig, defineConfig({
test: {
// Override settings from the main config for this specific test project.
name: 'integration',
environment: 'node',
// The path must be specific. By default, Vitest doesn't look in `src`
// unless the pattern explicitly includes it.
include: ['src/**/*.integration.test.ts'],
// CRITICAL: We must override the `exclude` property from the base vite.config.ts.
// Otherwise, the inherited `exclude` rule will prevent any integration tests from running.
// Setting it to an empty array removes all exclusion rules for this project.
exclude: [],
// This setup script starts the backend server before tests run.
globalSetup: './src/tests/setup/integration-global-setup.ts',
testTimeout: 15000, // Increased timeout for server startup and API calls.
// "singleThread: true" is removed in modern Vitest.
// Use fileParallelism: false to ensure test files run one by one to prevent port conflicts.
fileParallelism: false,
coverage: {
provider: 'v8',
// We remove 'text' here. The final text report will be generated by `nyc` after merging.
reporter: ['html', 'json-summary', 'json'],
reportsDirectory: '.coverage/integration',
clean: true,
},
}
}));