All checks were successful
PR Checks / lint-test-and-docker-build (pull_request) Successful in 2m27s
21 lines
661 B
TypeScript
21 lines
661 B
TypeScript
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<void> {
|
|
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;
|