freshyo/apps/backend/tests/setup.ts
2026-10-20 00:31:05 +05:30

14 lines
534 B
TypeScript

/**
* Loads tests/.env and applies the suite-wide timeout.
*
* Credentials are validated lazily by `helpers/env.ts`, so a missing value
* fails the suite that needs it with an actionable message.
*/
import { THIRTY_SECONDS_MS } from './constants'
import path from 'node:path'
import dotenv from 'dotenv'
dotenv.config({ path: path.resolve(__dirname, '.env') })
const timeout = Number(process.env.CACHE_POLL_TIMEOUT_MS ?? 180_000)
jest.setTimeout(Number.isFinite(timeout) && timeout > 0 ? timeout + THIRTY_SECONDS_MS : 180_000)