-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix(test): isolate environment in non-interactive-env hook tests #822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(test): isolate environment in non-interactive-env hook tests #822
Conversation
- 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
|
@sisyphus-dev-ai review this ulw ulw |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
PR Review: #822 - fix(test): isolate environment in non-interactive-env hook testsStatus: ✅ APPROVEThis PR correctly fixes a test isolation issue that could cause failures in CI environments where PowerShell is installed (even on Linux/macOS). What This FixesThe
Example scenario where this fails:
Changes Verified
Code Quality AssessmentStrengths:
Location in codebase: Additional ContextI verified that no other test files in the codebase need this fix:
This PR is the only place where baseline environment isolation is needed because:
RecommendationLGTM! Ship it! 🚢 This is a textbook example of proper test isolation. The fix is:
|
…e-yeongyu#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
…e-yeongyu#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
Summary
beforeEach()to ensure tests start with clean Unix-like environmentChanges
PSModulePathenvironment variable inbeforeEach()to prevent PowerShell detection on Linux CI runnersSHELL=/bin/bashto establish baseline Unix-like environmentContext
GitHub Actions CI runners have
PSModulePathset even on Linux systems, causing the non-interactive-env hook to incorrectly detect PowerShell as the shell. This led to test failures because tests expecting Unix behavior were getting PowerShell environment variables instead.The fix ensures all tests start from a known, clean state by explicitly clearing platform-specific variables in
beforeEach(), while still allowing individual tests to set these values when testing PowerShell-specific behavior.Testing
bun run typecheck bun testAll tests pass locally and on CI after this fix.
Related Issues
Summary by cubic
Fixes flaky non-interactive-env hook tests on CI by resetting shell-related env vars before each test. Ensures Unix-like defaults so tests run consistently while still allowing PowerShell-specific cases.
Written for commit 6015fce. Summary will update on new commits.