()
| 2 | import { cleanupOrphans, startServer, stopServer } from "./mode-start-new-bytebase"; |
| 3 | |
| 4 | async function globalSetup() { |
| 5 | cleanupOrphans(); |
| 6 | |
| 7 | let server: Awaited<ReturnType<typeof startServer>>; |
| 8 | try { |
| 9 | server = await startServer(); |
| 10 | } catch (err) { |
| 11 | // startServer spawns the server process and creates its temp data dir |
| 12 | // before it can fail (e.g. a /healthz timeout when the boot is slow). |
| 13 | // Playwright does NOT run globalTeardown when globalSetup throws, so tear |
| 14 | // the half-started server down here — otherwise a failed boot orphans a |
| 15 | // process group and temp dir that starve every subsequent run's boot. |
| 16 | stopServer(); |
| 17 | throw err; |
| 18 | } |
| 19 | |
| 20 | const { baseURL, adminEmail, adminPassword } = server; |
| 21 | saveTestEnv({ |
| 22 | baseURL, adminEmail, adminPassword, |
| 23 | project: "", instance: "", instanceId: "", database: "", databaseId: "", |
| 24 | }); |
| 25 | } |
| 26 | |
| 27 | export default globalSetup; |
nothing calls this directly
no test coverage detected