8000 test(bridge): only treat a Linux process as inside WSL2 by stlindenau · Pull Request #474 · amirlehmam/wmux · GitHub
[go: up one dir, main page]

Skip to content

test(bridge): only treat a Linux process as inside WSL2 - #474

Merged
amirlehmam merged 1 commit into
amirlehmam:masterfrom
stlindenau:fix-bridge-test-wslenv
Nov 25, 2026
Merged

amirlehmam merged 1 commit into
amirlehmam:masterfrom
stlindenau:fix-bridge-test-wslenv

Conversation

@stlindenau
Copy link
Copy Markdown
Contributor

tests/unit/wmux-bridge-transport.test.ts decides it runs inside WSL2 from WSL_DISTRO_NAME || WSLENV. On Windows that is wrong: Windows Terminal sets WSLENV=WT_SESSION:WT_PROFILE_ID: in every Windows profile.

Effect

In a Windows Terminal PowerShell the four WSL-only tests are not skipped and fail: the fake npiperelay.exe is a #!/usr/bin/env node script that Windows cannot execute (spawnCount is 0, the slow-relay test gets ''), and the bridge falls back to the default \\.\pipe\wmux, which is the real running wmux and answers unauthorized. The failing tests also send their payload to that real pipe.

Fix

isWslRuntime also requires process.platform === 'linux': only a Linux process can be inside a WSL2 distro.

Verification

  • Windows PowerShell with WSLENV=WT_SESSION:WT_PROFILE_ID:: the four tests failed before; with WSLENV cleared (what the fix amounts to) all six skip.
  • Linux: unchanged. Without WSL variables 2 pass and 4 skip; with WSLENV set, so the WSL-only tests run, 5 pass and 1 skips.

🤖 Generated with Claude Code

Windows Terminal sets WSLENV (WT_SESSION:WT_PROFILE_ID:) in every Windows
profile, so the bridge transport suite took a Windows PowerShell for a WSL2
distro and ran four WSL-only tests there: the fake npiperelay is a node script
Windows cannot execute, and the bridge fell back to the real wmux pipe, which
answered unauthorized.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@amirlehmam
amirlehmam merged commit b5cc268 into amirlehmam:master Nov 25, 2026
@stlindenau
stlindenau deleted the fix-bridge-test-wslenv branch November 26, 2026 21:37
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.

2 participants

0