Skip to content

fix(connections): restore the test environment in place so SSH tests pass on Node 26 - #328

Merged
gustmrg merged 1 commit into
mainfrom
fix/ssh-tests-node-26
Oct 31, 2026
Merged

gustmrg merged 1 commit into
mainfrom
fix/ssh-tests-node-26

Conversation

@gustmrg

@gustmrg gustmrg commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Nineteen SSH connection tests failed on Node 26, which engines allows and this machine uses by default, while passing on CI's Node 22. A developer on Node 26 saw red tests with misleading errors, and three earlier PR bodies blamed them on the machine's SSH keys. The tests now pass on both versions. Users see no change, because production code never assigns to process.env.

  • After each test, tests/electron/connections.test.ts, ssh-test.test.ts, and ssh-tunnel.test.ts ran process.env = { ...environment }. From Node 26, child processes do not see variables set on an assigned object, so tests/fixtures/fake-ssh.cjs stopped receiving its FAKE_SSH_* settings. The first test in a file still passed, since nothing had been assigned yet.
  • Added environmentRestorer in tests/helpers/restore-environment.ts, which removes added variables and restores the original values on the same object. The three files now use it.

Testing

  • npm run lint: clean (two pre-existing warnings in src/components/storage-*.tsx, untouched).
  • npm run format:check, npm run typecheck (all four tsconfigs), and npm run build: clean.
  • npm test: 2443 passed on Node 22.22.2 and on Node 26.13.0. Before this change, Node 26 failed 19 of them. No new tests; the 19 are the check.
  • A one-file script confirmed the cause: after assigning to process.env, a child process sees the new variable on Node 22 and 24, and not on Node 26.
  • Built app: not checked; the change touches no production code.

Not in this PR

CI still runs only Node 22. Adding Node 26 would cost about three more minutes on every PR, so it is left out for now.

…pass on Node 26

Nineteen SSH tests failed on Node 26 and passed on Node 22. After each
test, the three files assigned a copy to process.env, and from Node 26
child processes do not see variables set on an assigned object. The fake
ssh stopped receiving its FAKE_SSH_* settings, so a test expecting a
failure could get a successful connection.

A small helper now restores the environment in place, which works on
every version. Production code never assigns to process.env, so only
the tests change.
@gustmrg
gustmrg merged commit c2f6b99 into main Oct 31, 2026
1 check passed
@gustmrg
gustmrg deleted the fix/ssh-tests-node-26 branch October 31, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant