// vitest.config.integration.ts import { defineConfig } from 'vitest/config'; /** * This configuration is specifically for integration tests. * It runs tests in a Node.js environment, as they need to interact with a live backend server. */ export default defineConfig({ test: { name: 'integration', environment: 'node', include: ['**/*.integration.test.ts'], // 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, }, }, });