Repository navigation
Expand file tree
/
Copy pathenv.setup.ts
More file actions
34 lines (30 loc) · 1.5 KB
/
Copy pathenv.setup.ts
File metadata and controls
34 lines (30 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* Mirrors ../helpers/env.setup.ts (Jest's setupFiles entry) — same
* placeholder values, so this process passes the same Zod validation in
* src/config/env.ts. Re-exported rather than duplicated so the two lists
* of placeholders can't drift apart.
*
* The one addition: PORT. Jest's app is driven in-process by Supertest and
* never listens on anything, so it never needed one; this script does
* (see ./server.ts).
*/
import os from "node:os";
import path from "node:path";
import "../helpers/env.setup";
// A dedicated port, deliberately different from the real local dev API's
// 5050 — this process must never collide with (and can safely run
// alongside) a developer's actual `pnpm dev` session.
process.env.PORT = process.env.PORT ?? "5051";
// The e2e web server (apps/web/playwright.config.ts) runs on its own
// dedicated port 3001, separate from local dev's 3000, for the same
// reason — override the inherited ORIGIN_URL (3000) so CORS actually
// allows it.
process.env.ORIGIN_URL = "http://localhost:3001";
// Its own database, so a browser run and the Jest suite, which the root
// `test` script starts together, never empty each other's tables.
process.env.DATABASE_URL =
process.env.E2E_DATABASE_URL ?? "postgresql://localhost:5432/karmacircle_e2e";
// Event cover uploads land on disk in the e2e API (no Blob token), so they go
// to a throwaway folder instead of the working tree.
process.env.UPLOADS_DIR =
process.env.UPLOADS_DIR ?? path.join(os.tmpdir(), "karmacircle-e2e-uploads");