Files
blog/tests/e2e/global-setup.ts
T

19 lines
702 B
TypeScript
Raw Permalink Normal View History

2026-09-11 11:41:52 +02:00
import { startTestPocketbase } from '../support/pocketbase'
import { E2E_POCKETBASE_PORT } from '../../frontend/playwright.config'
/**
* Starts one PocketBase instance, shared by the whole e2e run, on the fixed
* port `playwright.config.ts` also bakes into the Nuxt server's env — so both
* sides can reference it without needing an async hand-off between them.
*
* Playwright keeps this module's closure alive and calls the returned
* function as teardown once all tests finish (no separate globalTeardown
* file needed).
*/
export default async function globalSetup() {
const pb = await startTestPocketbase({ port: E2E_POCKETBASE_PORT })
return async () => {
await pb.stop()
}
}