| 106 | } |
| 107 | |
| 108 | function startServer() { |
| 109 | const serverScript = path.join(projectRoot, 'scripts/local-e2e-server.ts'); |
| 110 | fs.mkdirSync(artifactsRoot, { recursive: true }); |
| 111 | |
| 112 | const child = spawn('bun', [serverScript], { |
| 113 | cwd: projectRoot, |
| 114 | detached: true, |
| 115 | stdio: 'ignore', |
| 116 | env: { |
| 117 | ...process.env, |
| 118 | E2E_ASSET_PORT: String(LOCAL_UPDATE_PORT), |
| 119 | }, |
| 120 | }); |
| 121 | child.unref(); |
| 122 | fs.writeFileSync(pidFile, String(child.pid)); |
| 123 | } |
| 124 | |
| 125 | function waitForServer(timeoutMs = 30000) { |
| 126 | const start = Date.now(); |