Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix: resolve CI-only test failures from environment differences

diegosouzapw72afe8fe0488
diff --git a/tests/integration/_chatPipelineHarness.ts b/tests/integration/_chatPipelineHarness.ts
index 57b2d745ed..da8ca1d13b 100644
--- a/tests/integration/_chatPipelineHarness.ts
+++ b/tests/integration/_chatPipelineHarness.ts
@@ -6,6 +6,9 @@ export async function createChatPipelineHarness(prefix) {
const testDataDir = fs.mkdtempSync(path.join(os.tmpdir(), `omniroute-${prefix}-`));
process.env.DATA_DIR = testDataDir;
process.env.REQUIRE_API_KEY = "false";
+ // Disable dashboard auth so direct route handler calls don't get 401
+ // (CI postinstall auto-generates DASHBOARD_PASSWORD)
+ process.env.DASHBOARD_PASSWORD = "";
// FASE-01: API_KEY_SECRET is required for CRC operations (no hardcoded fallback)
if (!process.env.API_KEY_SECRET) {
process.env.API_KEY_SECRET = "test-harness-secret-" + Date.now();
diff --git a/tests/integration/proxy-registry-flow.test.ts b/tests/integration/proxy-registry-flow.test.ts
index 1a6c71ba35..4ee9aa511c 100644
--- a/tests/integration/proxy-registry-flow.test.ts
+++ b/tests/integration/proxy-registry-flow.test.ts
@@ -6,6 +6,9 @@ import path from "node:path";
const TEST_DATA_DIR = fs.mkdtempSync(path.join(os.tmpdir(), "omniroute-proxy-registry-flow-"));
process.env.DATA_DIR = TEST_DATA_DIR;
+// Disable dashboard auth for direct route handler calls in CI
+// (postinstall auto-generates DASHBOARD_PASSWORD, causing 401 on management routes)
+process.env.DASHBOARD_PASSWORD = "";
const core = await import("../../src/lib/db/core.ts");
const providersDb = await import("../../src/lib/db/providers.ts");
diff --git a/tests/unit/guide-settings-route.test.ts b/tests/unit/guide-settings-route.test.ts
index a77fdd1be4..4e082b617b 100644
--- a/tests/unit/guide-settings-route.test.ts
+++ b/tests/unit/guide-settings-route.test.ts
@@ -10,6 +10,7 @@ const DUMMY_HOME = path.join(os.tmpdir(), "omniroute-qwen-test-" + Date.now());
const QWEN_CONFIG_PATH = path.join(DUMMY_HOME, ".qwen", "settings.json");
const QWEN_ENV_PATH = path.join(DUMMY_HOME, ".qwen", ".env");
const OPENCODE_CONFIG_PATH = path.join(DUMMY_HOME, ".config", "opencode", "opencode.json");
+const originalXDG = process.env.XDG_CONFIG_HOME;
type QwenProviderEntry = {
id?: string;
@@ -31,11 +32,16 @@ function buildRequest(body: any) {
test.beforeEach(async () => {
// Mock os.homedir to return our dummy path
os.homedir = () => DUMMY_HOME;
+ // Force XDG_CONFIG_HOME so resolveOpencodeConfigPath resolves to our dummy dir
+ // (CI runners often have XDG_CONFIG_HOME set, causing path mismatch)
+ process.env.XDG_CONFIG_HOME = path.join(DUMMY_HOME, ".config");
await fs.mkdir(path.dirname(QWEN_CONFIG_PATH), { recursive: true }).catch(() => {});
});
test.afterEach(async () => {
await fs.rm(DUMMY_HOME, { recursive: true, force: true }).catch(() => {});
+ if (originalXDG === undefined) delete process.env.XDG_CONFIG_HOME;
+ else process.env.XDG_CONFIG_HOME = originalXDG;
});
test("guide-settings POST creates new qwen settings.json if it doesn't exist", async () => {