Skip to content

Commit 76e0a33

Browse files
committed
fix: UT error
--bug=1
1 parent d695bcb commit 76e0a33

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@ release:
3737
$(PNPM) run release:local
3838

3939
test:
40-
$(PNPM) test
40+
$(PNPM) test
41+
42+
lint:
43+
$(PNPM) lint

test/core/completions/installers/zsh-installer.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,27 @@ import { ZshInstaller } from '../../../../src/core/completions/installers/zsh-in
88
describe('ZshInstaller', () => {
99
let testHomeDir: string;
1010
let installer: ZshInstaller;
11+
let originalZshEnv: string | undefined;
1112

1213
beforeEach(async () => {
14+
// Save and clear ZSH environment variable to avoid interference with tests
15+
originalZshEnv = process.env.ZSH;
16+
delete process.env.ZSH;
17+
1318
// Create a temporary home directory for testing
1419
testHomeDir = path.join(os.tmpdir(), `openspec-zsh-test-${randomUUID()}`);
1520
await fs.mkdir(testHomeDir, { recursive: true });
1621
installer = new ZshInstaller(testHomeDir);
1722
});
1823

1924
afterEach(async () => {
25+
// Restore ZSH environment variable
26+
if (originalZshEnv !== undefined) {
27+
process.env.ZSH = originalZshEnv;
28+
} else {
29+
delete process.env.ZSH;
30+
}
31+
2032
// Clean up test directory
2133
await fs.rm(testHomeDir, { recursive: true, force: true });
2234
});

0 commit comments

Comments
 (0)