Skip to content

Spawn the current Node executable in PTY tests - #1010

Merged
sindresorhus merged 1 commit into
vadimdemedes:masterfrom
Darkslayer3324j:fix/pty-tests-windows-node-path
Sep 20, 2026
Merged

sindresorhus merged 1 commit into
vadimdemedes:masterfrom
Darkslayer3324j:fix/pty-tests-windows-node-path

Conversation

@Darkslayer3324j

Copy link
Copy Markdown
Contributor

On Windows every test that starts a fixture through node-pty fails before the fixture runs:

Error: File not found:
    at new WindowsPtyAgent (node_modules\node-pty\lib\windowsPtyAgent.js:50:33)
    at spawn (node_modules\node-pty\lib\index.js:34:12)
    at test\helpers\run.ts:29:16

node-pty on Windows does not look the command up on PATH, so spawn('node', ...) cannot find the executable. This changes the five spawn('node', ...) calls in the tests (helpers/run.ts, helpers/term.ts, exit.tsx, render.tsx, issue-973-static-commit.tsx) to process.execPath. On other platforms that is the same Node that is running the tests, rather than whichever node happens to be first on PATH.

Windows 11, Node 24.13.1, npx ava (default concurrency), before vs after: 163 failing tests -> 46. The remaining failures are not this problem: they compare exact escape sequences and line counts that ConPTY rewrites, or hit timeouts under load, so I left them alone. Linux behaviour is unchanged; xo passes on the touched files.

Drafted with AI assistance (Claude Code); I ran the suite before and after and read the failures myself.

node-pty on Windows does not resolve 'node' through PATH, so every PTY-based
test failed with 'File not found'. Use process.execPath, which also makes the
tests run the same Node that started them on other platforms.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sindresorhus
sindresorhus merged commit 0fceaef into vadimdemedes:master Sep 20, 2026
2 checks passed
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