prettier !
This commit is contained in:
@@ -6,7 +6,7 @@ import viteConfig from './vite.config';
|
||||
// Ensure NODE_ENV is set to 'test' for all Vitest runs.
|
||||
process.env.NODE_ENV = 'test';
|
||||
|
||||
// 1. Separate the 'test' config (which has Unit Test settings)
|
||||
// 1. Separate the 'test' config (which has Unit Test settings)
|
||||
// from the rest of the general Vite config (plugins, aliases, etc.)
|
||||
// DEBUG: Use console.error to ensure logs appear in CI/CD output
|
||||
console.error('[DEBUG] Loading vitest.config.integration.ts...');
|
||||
@@ -30,38 +30,41 @@ console.error('[DEBUG] Base vite config keys:', Object.keys(baseViteConfig));
|
||||
* It MERGES with the main vite.config.ts to inherit plugins and aliases,
|
||||
* then overrides the test-specific settings for a Node.js environment.
|
||||
*/
|
||||
const finalConfig = mergeConfig(baseViteConfig, defineConfig({
|
||||
test: {
|
||||
// Override settings from the main config for this specific test project.
|
||||
name: 'integration',
|
||||
environment: 'node',
|
||||
// Point specifically to the new integration tests directory.
|
||||
// This pattern will match any test file inside `src/tests/integration/`.
|
||||
include: ['src/tests/integration/**/*.test.{ts,tsx}'],
|
||||
// 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',
|
||||
// The default timeout is 5000ms (5 seconds)
|
||||
testTimeout: 60000, // Increased timeout for server startup and API calls, especially AI services.
|
||||
// "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',
|
||||
reportOnFailure: true, // This ensures the report generates even if tests fail
|
||||
clean: true,
|
||||
const finalConfig = mergeConfig(
|
||||
baseViteConfig,
|
||||
defineConfig({
|
||||
test: {
|
||||
// Override settings from the main config for this specific test project.
|
||||
name: 'integration',
|
||||
environment: 'node',
|
||||
// Point specifically to the new integration tests directory.
|
||||
// This pattern will match any test file inside `src/tests/integration/`.
|
||||
include: ['src/tests/integration/**/*.test.{ts,tsx}'],
|
||||
// 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',
|
||||
// The default timeout is 5000ms (5 seconds)
|
||||
testTimeout: 60000, // Increased timeout for server startup and API calls, especially AI services.
|
||||
// "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',
|
||||
reportOnFailure: true, // This ensures the report generates even if tests fail
|
||||
clean: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}));
|
||||
}),
|
||||
);
|
||||
|
||||
console.error('[DEBUG] Integration Final Config - INCLUDE:', finalConfig.test?.include);
|
||||
console.error('[DEBUG] Integration Final Config - EXCLUDE:', finalConfig.test?.exclude);
|
||||
console.error('[DEBUG] ----------------------------------\n');
|
||||
|
||||
export default finalConfig;
|
||||
export default finalConfig;
|
||||
|
||||
Reference in New Issue
Block a user