From 31dc18657ce7140a7ef02c6219e61b859c110039 Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Wed, 29 Apr 2026 17:40:33 -0400 Subject: [PATCH] fix(cliproxy): fix base-config-loader __dirname path and stale mock.module paths - base-config-loader.ts moved from src/cliproxy/ to src/cliproxy/config/, so __dirname relative path needs one more .. to reach config/ dir - Update mock.module paths for proxy-detector and routing-strategy in non-colocated test files --- src/cliproxy/config/base-config-loader.ts | 2 +- tests/unit/health/cliproxy-port-check.test.ts | 2 +- tests/unit/web-server/cliproxy-routing-routes.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cliproxy/config/base-config-loader.ts b/src/cliproxy/config/base-config-loader.ts index 9e59131a..4f64121c 100644 --- a/src/cliproxy/config/base-config-loader.ts +++ b/src/cliproxy/config/base-config-loader.ts @@ -33,7 +33,7 @@ const configCache: Map = new Map(); function getBaseConfigPath(provider: CLIProxyProvider): string { // __dirname points to dist/cliproxy at runtime // Config files are at package root: ../config/ - const configDir = path.join(__dirname, '..', '..', 'config'); + const configDir = path.join(__dirname, '..', '..', '..', 'config'); return path.join(configDir, `base-${provider}.settings.json`); } diff --git a/tests/unit/health/cliproxy-port-check.test.ts b/tests/unit/health/cliproxy-port-check.test.ts index 396c733b..0e41c52a 100644 --- a/tests/unit/health/cliproxy-port-check.test.ts +++ b/tests/unit/health/cliproxy-port-check.test.ts @@ -11,7 +11,7 @@ import type { ProxyStatus } from '../../../src/cliproxy/proxy/proxy-detector'; // Mutable holder so each test can override the resolved value let mockStatus: ProxyStatus = { running: false, verified: false }; -mock.module('../../../src/cliproxy/proxy-detector', () => ({ +mock.module('../../../src/cliproxy/proxy/proxy-detector', () => ({ detectRunningProxy: async () => mockStatus, waitForProxyHealthy: async () => false, reclaimOrphanedProxy: () => null, diff --git a/tests/unit/web-server/cliproxy-routing-routes.test.ts b/tests/unit/web-server/cliproxy-routing-routes.test.ts index a3dd9bd6..1c828b84 100644 --- a/tests/unit/web-server/cliproxy-routing-routes.test.ts +++ b/tests/unit/web-server/cliproxy-routing-routes.test.ts @@ -42,7 +42,7 @@ describe('cliproxy routing routes', () => { applied: 'config-only', })); - mock.module('../../../src/cliproxy/routing-strategy', () => ({ + mock.module('../../../src/cliproxy/routing/routing-strategy', () => ({ readCliproxyRoutingState: readStateMock, applyCliproxyRoutingStrategy: applyStrategyMock, readCliproxySessionAffinityState: readAffinityStateMock,