test(coding-agent): preserve agent-dir env restore
This commit is contained in:
@@ -5,14 +5,7 @@ import * as path from "node:path";
|
||||
import { type ContextFile, contextFileCapability } from "@oh-my-pi/pi-coding-agent/capability/context-file";
|
||||
import { resetSettingsForTest, Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
|
||||
import { initializeWithSettings, loadCapability } from "@oh-my-pi/pi-coding-agent/discovery";
|
||||
import {
|
||||
__resetProfileSnapshotForTests,
|
||||
getActiveProfile,
|
||||
refreshDirsFromEnv,
|
||||
removeWithRetries,
|
||||
setAgentDir,
|
||||
setProfile,
|
||||
} from "@oh-my-pi/pi-utils";
|
||||
import { __resetDirsFromEnvForTests, removeWithRetries, setAgentDir } from "@oh-my-pi/pi-utils";
|
||||
|
||||
function restoreEnvValue(key: string, value: string | undefined): void {
|
||||
if (value === undefined) {
|
||||
@@ -28,14 +21,12 @@ describe("disabledExtensions runtime filtering", () => {
|
||||
let tempDir = "";
|
||||
let tempHomeDir = "";
|
||||
let originalHome: string | undefined;
|
||||
let originalActiveProfile: string | undefined;
|
||||
let originalAgentDirEnv: string | undefined;
|
||||
let originalOmpProfileEnv: string | undefined;
|
||||
let originalPiProfileEnv: string | undefined;
|
||||
|
||||
beforeEach(async () => {
|
||||
resetSettingsForTest();
|
||||
originalActiveProfile = getActiveProfile();
|
||||
originalAgentDirEnv = process.env.PI_CODING_AGENT_DIR;
|
||||
originalOmpProfileEnv = process.env.OMP_PROFILE;
|
||||
originalPiProfileEnv = process.env.PI_PROFILE;
|
||||
@@ -65,12 +56,7 @@ describe("disabledExtensions runtime filtering", () => {
|
||||
restoreEnvValue("OMP_PROFILE", originalOmpProfileEnv);
|
||||
restoreEnvValue("PI_PROFILE", originalPiProfileEnv);
|
||||
restoreEnvValue("PI_CODING_AGENT_DIR", originalAgentDirEnv);
|
||||
if (originalActiveProfile !== undefined) {
|
||||
setProfile(originalActiveProfile);
|
||||
} else {
|
||||
refreshDirsFromEnv();
|
||||
__resetProfileSnapshotForTests();
|
||||
}
|
||||
__resetDirsFromEnvForTests();
|
||||
await removeWithRetries(tempHomeDir);
|
||||
await removeWithRetries(tempDir);
|
||||
});
|
||||
|
||||
@@ -63,6 +63,7 @@ function createFixture(opts: {
|
||||
ui: { requestRender },
|
||||
statusLine: { invalidate: vi.fn() },
|
||||
updateEditorTopBorder: vi.fn(),
|
||||
noteDisplayableThinkingContent: vi.fn(() => false),
|
||||
streamingComponent,
|
||||
streamingMessage: opts.streamingMessage,
|
||||
pendingTools: new Map(),
|
||||
|
||||
@@ -49,6 +49,7 @@ function createFixture(streamingMessage: AssistantMessage) {
|
||||
settings,
|
||||
statusLine: { invalidate: vi.fn() },
|
||||
updateEditorTopBorder: vi.fn(),
|
||||
noteDisplayableThinkingContent: vi.fn(() => false),
|
||||
streamingComponent: { updateContent: vi.fn(), markTranscriptBlockFinalized: vi.fn() },
|
||||
streamingMessage,
|
||||
pendingTools,
|
||||
|
||||
Reference in New Issue
Block a user