import { defineConfig, mergeConfig } from 'vitest/config';
import integrationConfig from './vitest.config.integration';

const e2eConfig = mergeConfig(
  integrationConfig,
  defineConfig({
    test: {
      name: 'e2e',
      // Point specifically to E2E tests
      include: ['src/tests/e2e/**/*.e2e.test.ts'],
      // Increase timeout for E2E flows that involve AI or full API chains
      testTimeout: 120000,
      coverage: {
        reportsDirectory: '.coverage/e2e',
      },
    },
  }),
);

// Explicitly override the include array to ensure we don't inherit integration tests
// (mergeConfig might concatenate arrays by default)
if (e2eConfig.test) {
  e2eConfig.test.include = ['src/tests/e2e/**/*.e2e.test.ts'];
}

export default e2eConfig;