Skip to content

Commit c38b078

Browse files
authored
fix(test): isolate environment in non-interactive-env hook tests (#822)
- Delete PSModulePath in beforeEach() to prevent CI cross-platform detection - Set SHELL=/bin/bash to ensure tests start with clean Unix-like environment - Fixes flaky test failures on GitHub Actions CI runners - Tests can still override these values for PowerShell-specific behavior
1 parent 5e44996 commit c38b078

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/hooks/non-interactive-env/index.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ describe("non-interactive-env hook", () => {
1313
SHELL: process.env.SHELL,
1414
PSModulePath: process.env.PSModulePath,
1515
}
16+
// #given clean Unix-like environment for all tests
17+
// This prevents CI environments (which may have PSModulePath set) from
18+
// triggering PowerShell detection in tests that expect Unix behavior
19+
delete process.env.PSModulePath
20+
process.env.SHELL = "/bin/bash"
1621
})
1722

1823
afterEach(() => {

0 commit comments

Comments
 (0)