Auto-skip e2e tests when TEST_DATABASE_URL is not configured
Some checks failed
CI / ci (push) Has been cancelled

Previously, e2e tests would fail with a confusing URL parse error when
TEST_DATABASE_URL was not set. Now SKIP_DB_TESTS automatically becomes
true when the database URL is missing, gracefully skipping these tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
igm
2026-01-12 15:15:15 +08:00
parent f9f1dc7403
commit 9c6694cad4

View File

@@ -2,9 +2,12 @@ import { describe } from "bun:test";
/**
* Skip flag for database-dependent tests.
* Set SKIP_DB_TESTS=1 to skip e2e tests that require a database.
* Tests are skipped when:
* - SKIP_DB_TESTS=1 is explicitly set, OR
* - TEST_DATABASE_URL is not configured
*/
export const SKIP_DB_TESTS: boolean = process.env.SKIP_DB_TESTS === "1";
export const SKIP_DB_TESTS: boolean =
process.env.SKIP_DB_TESTS === "1" || !process.env.TEST_DATABASE_URL;
const _describeSkipIf = describe.skipIf(SKIP_DB_TESTS);