Files
SnapOtter/tests/setup/stryker-api-env.ts
T
SnapOtterandGitHub 301e6eb01a test: coverage campaign and mutation testing across five packages (#628)
Coverage 83.6 to 87.36% lines, 81.63 to 84.14% branches. Mutation testing across five packages: image-engine 85, media-engine 92, doc-engine 87, shared+enterprise 86, apps/api security and jobs slice. Runs all five lanes weekly. Fixes the silently-broken mutation CI (babel pin), a redact-pdf envelope-shape test bug, an untested enterprise license valid-signature path, and an audit test that only exercised a hand-copied reproduction. Test and config only, no product code changes beyond the babel pin and one test-only oidc export. Full suite: 16,712 pass, 0 fail.
2026-07-24 17:36:57 +08:00

16 lines
889 B
TypeScript

// Minimal env stub for the apps/api mutation lane. The api unit tests
// (tests/unit/api) are pure logic and never build a real app or touch the DB
// (0 of 140 use buildTestApp), but some apps/api/src modules read env at import
// time. Set harmless dummy values so those imports resolve WITHOUT any Postgres
// or Redis connection - this lane deliberately skips the testcontainer
// global-setup and per-fork DB cloning that the full suite uses.
import os from "node:os";
import path from "node:path";
process.env.NODE_ENV ??= "test";
process.env.DATABASE_URL ??= "postgres://dummy:dummy@127.0.0.1:5432/dummy";
process.env.REDIS_URL ??= "redis://127.0.0.1:6379";
process.env.DATA_DIR ??= path.join(os.tmpdir(), "snapotter-stryker-api");
process.env.WORKSPACE_PATH ??= path.join(os.tmpdir(), "snapotter-stryker-api", "workspace");
process.env.BULLMQ_PREFIX ??= "snapotter_stryker_api";