test(tui): isolate terminalSetup tests from SSH env - #18929
Conversation
f16ab58 to
f30bcb2
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating this environment-sensitive test path. The underlying premise remains valid on current main: configureTerminalKeybindings() falls back to process.env at ui-tui/src/lib/terminalSetup.ts:284 and short-circuits SSH sessions at :290-295; the affected tests omit options.env (for example ui-tui/src/__tests__/terminalSetup.test.ts:71-75).
Problems
- The added
vi.stubEnvcalls are not restored.ui-tui/vitest.config.ts:3-7does not enableunstubEnvs, whose installed Vitest default is false, so later tests in the same worker can inherit blank SSH variables. The established local pattern restores them inui-tui/src/__tests__/theme.test.ts:37-40.
Suggested changes
- Import
afterEachand callvi.unstubAllEnvs()after each test in this suite.
This is an automated hermes-sweeper review.
0b8a025 to
f4c3e2b
Compare
|
Rebased onto current |
f4c3e2b to
9ecacd6
Compare
|
Closing record: the original branch commit was not merged directly, but merged PR #66373 independently landed the same fix on |
What does this PR do?
Current
mainnow isolates theterminalSetup.test.tskeybinding tests from ambient SSH environment variables with the same fix this PR proposed. The production SSH guard remains covered explicitly, while non-SSH keybinding tests no longer inheritSSH_CONNECTION,SSH_TTY, orSSH_CLIENTfrom the developer or CI shell. Stubbed environment variables are restored after every test so this suite cannot leak state into later tests in the same Vitest worker.Related Issue
Fixes #18939
Type of Change
Changes Made
maincontains the global SSH-variable stubs,vi.unstubAllEnvs()cleanup, and explicit SSH behavior coverage from merged fix(ci): make tests, workflows, and attribution reliable under load #66373.How to Test
From
ui-tui/:npm test -- src/__tests__/terminalSetup.test.tsSSH_CONNECTION,SSH_TTY, andSSH_CLIENTvalues in the process environment.npm run typechecknpm run buildFrom the repository root:
Latest local results after rebasing onto current
main:main: 20/20 passed.SSH_CONNECTION,SSH_TTY, andSSH_CLIENT: 20/20 passed; TypeScript typecheck passed.npm run build:ink, with non-emptySSH_CONNECTION,SSH_TTY, andSSH_CLIENT: 107/107 files passed; 1,125 tests passed and 1 skipped.Tested on Fedora Linux.
Checklist
Code
fix(scope):,feat(scope):, etc.)Documentation & Housekeeping
docs/, docstrings) — N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs