import type { FullConfig } from '@playwright/test'; import { spawnSync } from 'child_process'; import { resolve } from 'path'; import { config as dotenvConfig } from 'dotenv'; dotenvConfig({ path: resolve(process.cwd(), '.env.test'), override: true }); async function globalSetup(_config: FullConfig): Promise { console.log('[e2e] Seeding test database via Bun...'); const result = spawnSync('bun', ['run', 'e2e/setup/seed-db.ts'], { env: { ...process.env }, stdio: 'inherit', cwd: process.cwd() }); if (result.status !== 0) { throw new Error(`[e2e] DB seed script failed with exit code ${result.status}`); } } export default globalSetup;