fix(api,ci): remove type-only imports for DI and isolate CI ports from dev
- Remove `type` keyword from NestJS injectable class imports across all modules to fix runtime DI resolution (330+ handler/listener files) - Offset CI docker-compose ports (5433/6380/8109/9002) to avoid conflicts with running dev containers - Update .env.test, playwright.config.ts, and e2e workflow to use isolated CI ports with configurable overrides - Fix prisma/seed.ts to use deterministic IDs for Prisma 7 upsert compatibility (phoneHash replaced phone as unique index) - Add dedicated Docker bridge network for CI service containers Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,12 +7,17 @@ if (!process.env.CI) {
|
||||
config({ path: path.resolve(__dirname, '.env.test'), override: true });
|
||||
}
|
||||
|
||||
// Server ports — configurable via env to avoid conflicts with dev containers.
|
||||
// Defaults match .env.test (3011/3010); GitHub Actions uses 3001/3000.
|
||||
const API_PORT = process.env.API_PORT ?? '3001';
|
||||
const WEB_PORT = process.env.WEB_PORT ?? '3000';
|
||||
|
||||
/**
|
||||
* Playwright E2E configuration for Goodgo Platform.
|
||||
*
|
||||
* Projects:
|
||||
* - "api" — tests against the NestJS API (port 3001)
|
||||
* - "web" — tests against the Next.js frontend (port 3000)
|
||||
* - "api" — tests against the NestJS API (port 3011 local CI / 3001 GH Actions)
|
||||
* - "web" — tests against the Next.js frontend (port 3010 local CI / 3000 GH Actions)
|
||||
*
|
||||
* Database isolation:
|
||||
* - globalSetup runs migrations + seed on the test DB
|
||||
@@ -41,7 +46,7 @@ export default defineConfig({
|
||||
name: 'api',
|
||||
testDir: './e2e/api',
|
||||
use: {
|
||||
baseURL: process.env.API_BASE_URL ?? 'http://localhost:3001/api/v1/',
|
||||
baseURL: process.env.API_BASE_URL ?? `http://localhost:${API_PORT}/api/v1/`,
|
||||
},
|
||||
},
|
||||
// Web E2E tests — Chromium browser
|
||||
@@ -50,27 +55,32 @@ export default defineConfig({
|
||||
testDir: './e2e/web',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
baseURL: process.env.WEB_BASE_URL ?? 'http://localhost:3000',
|
||||
baseURL: process.env.WEB_BASE_URL ?? `http://localhost:${WEB_PORT}`,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
webServer: [
|
||||
{
|
||||
command: 'pnpm --filter @goodgo/api run dev',
|
||||
url: 'http://localhost:3001/api/v1/docs',
|
||||
command: `PORT=${API_PORT} pnpm --filter @goodgo/api run dev`,
|
||||
url: `http://localhost:${API_PORT}/api/v1/docs`,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 60_000,
|
||||
env: {
|
||||
NODE_ENV: 'test',
|
||||
PORT: API_PORT,
|
||||
DATABASE_URL: process.env.DATABASE_URL ?? '',
|
||||
},
|
||||
},
|
||||
{
|
||||
command: 'pnpm --filter @goodgo/web run dev',
|
||||
url: 'http://localhost:3000',
|
||||
command: `pnpm exec next dev --port ${WEB_PORT}`,
|
||||
cwd: './apps/web',
|
||||
url: `http://localhost:${WEB_PORT}`,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 30_000,
|
||||
env: {
|
||||
PORT: WEB_PORT,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user