Skip to content

Commit 6a9ce8e

Browse files
committed
fix: enhance environment variable checks to skip tests in CI when missing
1 parent 9e8bc8c commit 6a9ce8e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

frontend/scripts/integration.test.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ import crypto from "node:crypto";
33
import { createClient } from "@supabase/supabase-js";
44

55
const required = ["TEST_TEACHER_EMAIL", "TEST_TEACHER_PASSWORD"];
6+
const missingCreds = required.filter((key) => !process.env[key]);
67

7-
for (const key of required) {
8-
if (!process.env[key]) {
9-
throw new Error(`Missing required env var: ${key}`);
8+
if (missingCreds.length > 0) {
9+
if (process.env.CI === "true") {
10+
console.log(`Skipping integration test: missing env vars ${missingCreds.join(", ")}`);
11+
process.exit(0);
1012
}
13+
throw new Error(`Missing required env var: ${missingCreds[0]}`);
1114
}
1215

1316
const supabaseUrlEnv = process.env.SUPABASE_URL ?? process.env.NEXT_PUBLIC_SUPABASE_URL ?? "";

0 commit comments

Comments
 (0)