-
Notifications
You must be signed in to change notification settings - Fork 0
Enable Windows PTY interactive tests #23
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added PowerShell PTY support to e2e_interactive_test.go: - newPtyPowerShell() function to spawn PowerShell in a PTY - TestInteractiveCheckoutWithoutArgsPowerShell() for interactive prompt testing - TestNonInteractiveCheckoutWithArgsPowerShell() for explicit branch checkout Enabled Windows e2e tests in CI workflow: - Added e2e-windows job for windows-latest runners - Tests both powershell and pwsh shells - Uses PTY for true interactive testing like macOS/Linux Note: PowerShell shellenv still uses direct wt.exe invocation without PTY wrapper (unlike bash/zsh). Interactive tests will likely fail until we add a PTY wrapper similar to the script(1) approach used on Unix. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added interactive terminal detection to PowerShell shellenv function: - Uses [Console]::IsOutputRedirected to detect if running in a real terminal - Interactive mode: Runs wt.exe directly with Tee-Object to preserve TTY/PTY - Non-interactive mode: Captures output normally - Both modes: Extracts TREE_ME_CD marker from temp file for auto-cd This is the PowerShell equivalent of the Unix script(1) approach used in bash/zsh. It allows promptui interactive menus to work correctly by preserving the TTY connection while still capturing output for auto-cd. References: - https://powershellmagazine.com/2013/05/13/pstip-detecting-if-the-console-is-in-interactive-mode/ - https://superuser.com/questions/900032/detect-powershell-function-input-is-redirected 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Fixed PowerShell error: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Command' The issue was using `Invoke-Expression (& 'wt' shellenv)` which tries to pass an array to Invoke-Expression. Changed to: `& 'wt' shellenv | Invoke-Expression` This pipes the output line-by-line to Invoke-Expression, which handles it correctly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
PowerShell tests can only run on Windows because: - shellenv detects OS at compile time (runtime.GOOS) - On macOS/Linux, shellenv outputs bash/zsh syntax - PowerShell cannot execute bash/zsh shell functions Added platform check using filepath.Separator to skip PowerShell tests on Unix platforms. Tests will only run on Windows where shellenv outputs PowerShell syntax. Verified locally on macOS: - PowerShell tests skip correctly - Bash/zsh tests continue to pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #23 +/- ##
==========================================
- Coverage 20.17% 19.49% -0.68%
==========================================
Files 1 1
Lines 461 477 +16
==========================================
Hits 93 93
- Misses 362 378 +16
Partials 6 6
🚀 New features to boost your workflow:
|
Changed shellenv from compile-time OS detection (runtime.GOOS) to runtime shell detection by checking for the PSModulePath environment variable. Benefits: - PowerShell Core (pwsh) now works on macOS, Linux, and Windows - Tests can run on any platform where PowerShell is installed - No platform-specific test skipping needed Changes: 1. main.go: - Removed runtime import (no longer needed) - Check PSModulePath env var instead of runtime.GOOS - Output PowerShell syntax if PSModulePath is set - Output bash/zsh syntax otherwise 2. e2e_interactive_test.go: - Removed platform checks (filepath.Separator) - Updated PowerShell initialization to use Out-String - Fixed: & wt shellenv | Out-String | Invoke-Expression Verified locally on macOS: - PowerShell (pwsh): shellenv outputs PowerShell syntax ✓ - Bash: shellenv outputs bash/zsh syntax ✓ - PowerShell tests skip if pwsh not available ✓ Note: PowerShell e2e tests load shellenv successfully but command execution needs debugging. Will address in follow-up commit. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added comprehensive PowerShell setup guide to README: - How to add shellenv to $PROFILE - How to find and edit profile location - Verification steps (Get-Command wt) - Cross-platform notes (Windows, macOS, Linux) Restructured Shell Integration section: - Separate subsections for Bash/Zsh and PowerShell - Clear platform guidance - Step-by-step instructions for PowerShell users Key instruction: & wt shellenv | Out-String | Invoke-Expression This enables auto-cd and interactive prompts in PowerShell. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…ows) Fixed two critical issues in PowerShell shellenv function: 1. Removed hardcoded wt.exe references (doesn't exist on Unix) 2. Used Get-Command wt -CommandType Application to find executable - Avoids infinite recursion (function calling itself) - Works on Windows (finds wt.exe) and Unix (finds wt) Before: PowerShell shellenv was broken on macOS/Linux After: PowerShell works on all platforms where pwsh is installed Verified locally on macOS: - wt version: ✓ works - wt list: ✓ works - Function correctly wraps executable 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added PowerShell (pwsh) to test matrix for cross-platform testing:
**macOS runners:**
- Added 'pwsh' to shell matrix (bash, zsh, pwsh)
- Install PowerShell via homebrew if needed
- Run PowerShell PTY interactive tests
**Linux (Ubuntu) runners:**
- Install PowerShell 7.4.6 from official .deb package
- PowerShell tests now run alongside bash/zsh tests
- All PTY tests (bash, zsh, pwsh) execute on Linux
**Shellenv validation:**
- Updated validation to handle PowerShell syntax ("function wt" vs "wt()")
- Check for PowerShell-specific features (Get-Command, PowerShell integration)
This enables testing the new cross-platform PowerShell shellenv on all platforms,
not just Windows. Now we have:
- Linux: bash, zsh, pwsh ✓
- macOS: bash, zsh, pwsh ✓
- Windows: pwsh, powershell ✓
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Owner
Author
|
Closing in favor of merged PR #24 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
newPtyPowerShell) similar to bash/zshpowershellandpwshChanges
e2e_interactive_test.go:
newPtyPowerShell()to spawn PowerShell in a PTYTestInteractiveCheckoutWithoutArgsPowerShell()TestNonInteractiveCheckoutWithArgsPowerShell().github/workflows/ci.yml:
e2e-windowsjobwindows-latestwith matrix forpowershellandpwshKnown Issue
The PowerShell shellenv function currently uses direct
wt.exeinvocation without a PTY wrapper (unlike bash/zsh which usescript(1)). This means interactive tests will likely fail until we add an equivalent PTY wrapper for Windows.Next step: Add Windows PTY wrapper to PowerShell shellenv (similar to how bash/zsh use
scriptcommand).Test Plan
🤖 Generated with Claude Code