Run PTY and fake-tool integration tests on Windows - #444
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
…al browser Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…wait() Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…reground group Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
skyrpex
marked this pull request as ready for review
August 11, 2026 10:18
anisaoshafi
approved these changes
Aug 11, 2026
anisaoshafi
left a comment
Collaborator
There was a problem hiding this comment.
Great job un-skipping so many tests, Cristian!
We gain more confidence around windows behaviour and avoid breaking things in the future 🪨 ![]()
Thanks for challenging the status quo and finding this solution.
Skimmed through the code and looks good to me!
skyrpex
added a commit
that referenced
this pull request
Aug 12, 2026
Re-applies the testify-to-must migration and snapshot conversions on top of the Windows PTY/fake-tool test rework from #444. Co-Authored-By: Claude <noreply@anthropic.com>
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
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.
Motivation
Windows CI skipped ~48 integration tests in two whole categories: every PTY-based test (
creack/ptyhas no Windows support) and every test faking an external CLI (aws,az,terraform,cdk,sam,aws_completer) with a#!/bin/shscript. That left the interactive paths — login flow, setup prompts, emulator selector, spinner behavior,--jsonTTY gating — with zero Windows coverage, exactly where OS-specific bugs (keyring,%AppData%paths, ConPTY rendering) would hide.Solution
test/integration/pty_helpers_test.go):runLstkInPTY/startLstkInPTY/startCmdInPTYreturn aptyProcwithwaitForOutput/write/wait/kill, backed bycharmbracelet/x/xpty(Unix PTY on macOS/Linux, ConPTY on Windows). Output is ANSI-stripped (ConPTY injects its own repaint sequences),waityields an*exec.ExitErroron every platform, and the ConPTY buffer is wide (300 cols) so its line re-wrapping can't break substring assertions. All 31 directpty.Startsites migrated;creack/ptyremains only in the!windows-tagged signal-forwarding tests.test-samples/faketool+faketool_test.go): one Go stand-in binary, built once per run and copied onto PATH under the impersonated name, driven by a JSON sidecar (placeholder echo lines,--version-style arg cases, sleep, exit codes, record-to-file). Replaces every shell-script fake, includingaws_completerand the fake browser openers (rundll32on Windows).env.WithHome(dir)setsHOME+USERPROFILE+APPDATA(Windows binaries read the latter two), swept across all 119With(env.Home, ...)sites;unreachableDockerHostis nowtcp://localhost:1(valid on every OS, unlike a unix socket path).requireDocker— no nested virtualization on Windows CI), unix-socket tests, POSIX signal/os.Interrupttests, bash completion, symlink-permission tests, the two inner-PTY streaming tests (proc.RunInPTYis unix-only), and one read-only-directory permission test. One stale skip (az_interception, which uses no PTY) removed outright.After this, Windows runs the same test set macOS does, modulo the inherent list above. Verified:
go vet/build clean for darwin andGOOS=windows,make lintclean on both modules, unit tests pass, and the migrated integration tests (including interactive PTY flows) pass locally on macOS with Docker.Docs
Nothing user-facing to document — test infrastructure only. CLAUDE.md's Testing section is updated in this PR with the new conventions (use the PTY helpers, use faketool instead of shell scripts, no convenience
GOOS == "windows"skips,tcp://localhost:1for unreachable Docker).Review
Human review advisable: wide test-infrastructure change, and the ConPTY drain/close ordering in
ptyProc.waitis behavior-sensitive. Real ConPTY behavior is only provable on Windows CI — watch that job for flakes in TUI-layout assertions (TestStatusEndpointURLInteractiveRendersTUIis the most at-risk).🤖 Generated with Claude Code