mirror of
https://github.com/Tencent/teamai-cli.git
synced 2026-10-02 03:14:40 +08:00
fix(tests): isolate Claude config dir from model tests
(cherry picked from commit e567ac31e5)
This commit is contained in:
@@ -35,6 +35,7 @@ let originalGuardedEnv: Record<string, string | undefined>;
|
||||
|
||||
beforeEach(async () => {
|
||||
home = await fse.mkdtemp(path.join(os.tmpdir(), 'teamai-model-config-'));
|
||||
vi.stubEnv('CLAUDE_CONFIG_DIR', undefined);
|
||||
originalHome = process.env.HOME;
|
||||
process.env.HOME = home;
|
||||
originalGuardedEnv = {};
|
||||
@@ -53,6 +54,7 @@ beforeEach(async () => {
|
||||
|
||||
afterEach(async () => {
|
||||
process.env.HOME = originalHome;
|
||||
vi.unstubAllEnvs();
|
||||
for (const key of GUARDED_ENV_KEYS) {
|
||||
const value = originalGuardedEnv[key];
|
||||
if (value === undefined) delete process.env[key];
|
||||
|
||||
@@ -203,6 +203,7 @@ describe('uninstall', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
tmpDir = await fse.mkdtemp(path.join(os.tmpdir(), 'teamai-uninstall-test-'));
|
||||
vi.stubEnv('CLAUDE_CONFIG_DIR', undefined);
|
||||
mockAutoDetectInit.mockReset();
|
||||
mockReconcileHooks.mockReset();
|
||||
mockSaveLocalConfig.mockReset();
|
||||
|
||||
Reference in New Issue
Block a user