SPB Git

Repository Public

serve.ts 808 B 17 lines typescript

1// Starts the built application against a freshly emptied test database.2import fs from "node:fs"3import os from "node:os"4import path from "node:path"5import postgres from "postgres"67const DB = process.env.SPM_TEST_DB ?? "postgres://127.0.0.1/sp_message_test"8if (!/_test$/.test(DB)) throw new Error("e2e tests refuse to run outside a *_test database")9const sql = postgres(DB, { onnotice: () => {} })10await sql.unsafe("drop schema public cascade; create schema public;")11await sql.end()12Object.assign(process.env, {13  DATABASE_URL: DB, PORT: "8741", SPM_ORIGIN: "http://localhost:8741", SPM_RP_ID: "localhost", SPM_LOG_LEVEL: "warn", SPM_RATE_SCALE: "20",14  SPM_DATA_DIR: fs.mkdtempSync(path.join(os.tmpdir(), "spm-e2e-")), SPM_WEB_DIR: path.resolve("dist/web"),15})16await import("../../server/src/index")17
Files main
Menu

Theme