Skip to content

Fix Windows test failures by removing .cmd fixtures and adding test bridge injection#364

Merged
mmprotest merged 1 commit into
mainfrom
mmprotest/fix-windows-test-failures-in-pi-villani
May 29, 2026
Merged

Fix Windows test failures by removing .cmd fixtures and adding test bridge injection#364
mmprotest merged 1 commit into
mainfrom
mmprotest/fix-windows-test-failures-in-pi-villani

Conversation

@mmprotest

Copy link
Copy Markdown
Owner

Motivation

  • Tests on Windows were failing with spawn EINVAL because test fixtures generated .cmd wrappers or wrote batch text to files named *.exe, which Node cannot spawn with shell: false and are not real executables.
  • The goal is to make the test harness cross-platform without changing production runtime launching semantics (spawn(..., { shell: false })).

Description

  • Replace generated .cmd/shell-wrapper test fixtures with temporary Node bridge modules and CommandSpec usage in integrations/pi-villani/src/process.test.ts so tests invoke process.execPath directly; updated file: process.test.ts.
  • Add a scoped test-only bridge starter injection hook to integrations/pi-villani/src/index.ts (bridgeStarter + __setBridgeStarterForTests) so tests can inject a mock starter while production defaults to startVillaniBridgeProcess.
  • Update integrations/pi-villani/src/extension.test.ts to install a mock bridge starter that launches the temporary bridge.mjs via process.execPath, to avoid creating .cmd wrappers; ensure injected starters/prompters are restored in every finally block and add a waitForCondition helper for synchronization.
  • Change the cached-runtime test to create a verified cached-runtime placeholder file that is not executed and assert the resolved cached path is passed to the bridge starter (avoid writing batch text into villani-code.exe).
  • Preserve production subprocess safety: no changes to production spawn options (still uses shell: false).
  • Modified files: integrations/pi-villani/src/index.ts, integrations/pi-villani/src/process.test.ts, integrations/pi-villani/src/extension.test.ts.

Testing

  • Ran cd integrations/pi-villani && npm test; result: test suite passed (38 tests, 38 passed, 0 failed).
  • Ran cd integrations/pi-villani && npm run build; result: TypeScript build succeeded.
  • Attempted cd integrations/pi-villani && pi install . in this environment but pi is not installed here, so it could not be executed (not run).

Codex Task

@mmprotest mmprotest merged commit 94bc59d into main May 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant