Files
flyer-crawler.projectium.com/vitest.config.e2e.ts
Torben Sorensen 771f59d009
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 22m47s
more api versioning work -whee
2026-01-28 09:58:28 -08:00

77 lines
2.7 KiB
TypeScript

// vitest.config.e2e.ts
import { defineConfig, mergeConfig } from 'vitest/config';
import type { UserConfig } from 'vite';
import viteConfig from './vite.config';
// Ensure NODE_ENV is set to 'test' for all Vitest runs.
process.env.NODE_ENV = 'test';
// Define a type that includes the 'test' property from Vitest's config.
type ViteConfigWithTest = UserConfig & { test?: UserConfig['test'] };
const { test: _unusedTest, ...baseViteConfig } = viteConfig as ViteConfigWithTest;
/**
* E2E test configuration.
* Uses a DIFFERENT port (3098) than integration tests (3099) to allow
* both test suites to run sequentially without port conflicts.
*/
const e2eConfig = mergeConfig(
baseViteConfig,
defineConfig({
test: {
name: 'e2e',
environment: 'node',
// Point specifically to E2E tests
include: ['src/tests/e2e/**/*.e2e.test.ts'],
exclude: [],
// E2E tests use a different port to avoid conflicts with integration tests
env: {
NODE_ENV: 'test',
BASE_URL: 'https://example.com',
FRONTEND_URL: 'https://example.com',
// Use port 3098 for E2E tests (integration uses 3099)
TEST_PORT: '3098',
// ADR-008: API versioning - all routes use /api/v1 prefix
VITE_API_BASE_URL: 'http://localhost:3098/api/v1',
},
// E2E tests have their own dedicated global setup file
globalSetup: './src/tests/setup/e2e-global-setup.ts',
setupFiles: ['./src/tests/setup/global.ts'],
// Increase timeout for E2E flows that involve AI or full API chains
testTimeout: 120000,
hookTimeout: 60000,
fileParallelism: false,
coverage: {
provider: 'v8',
// Include 'text' reporter so coverage summary appears after e2e tests complete.
reporter: [['text', { maxCols: 200 }], 'html', 'json-summary', 'json'],
reportsDirectory: '.coverage/e2e',
reportOnFailure: true,
clean: true,
// Include server-side code for true e2e coverage measurement
include: [
'src/routes/**/*.{ts,tsx}',
'src/middleware/**/*.{ts,tsx}',
'src/controllers/**/*.{ts,tsx}',
'src/services/**/*.{ts,tsx}',
'src/config/**/*.{ts,tsx}',
'server.ts',
],
exclude: [
'src/tests/**',
'src/**/*.test.{ts,tsx}',
'src/**/*.d.ts',
'src/services/apiClient.ts', // Client-side wrapper, not server code
'src/services/logger.client.ts',
'src/services/sentry.client.ts',
'src/services/eventBus.ts', // Client-side only
'src/services/processingErrors.ts', // Client-side only
],
},
},
}),
);
export default e2eConfig;