Files

31 lines
1020 B
TypeScript

import { startServers } from './server-utils.js';
import { E2E_BACKEND_PORT, E2E_FRONTEND_PORT } from './playwright.config.js';
import { unlinkSync } from 'fs';
import { homedir } from 'os';
import { join } from 'path';
function cleanupTestFiles() {
const testFile = join(homedir(), 'foo.md');
try {
unlinkSync(testFile);
console.log('Cleaned up test file:', testFile);
} catch {
// File doesn't exist, ignore
}
}
export default async function globalSetup() {
// Clean up test files from previous runs
cleanupTestFiles();
// Skip if servers are managed externally (e.g., by scripts/test)
if (process.env.SKIP_SERVER_SETUP) {
console.log('\n=== Skipping server setup (SKIP_SERVER_SETUP is set) ===\n');
return;
}
console.log('\n=== Starting E2E Test Environment ===\n');
console.log(`Backend port: ${E2E_BACKEND_PORT}, Frontend port: ${E2E_FRONTEND_PORT}`);
await startServers(E2E_BACKEND_PORT, E2E_FRONTEND_PORT);
console.log('\n=== E2E Test Environment Ready ===\n');
}