From e65266f8d95c261696935797a557bd56370bda2d Mon Sep 17 00:00:00 2001 From: chr1syy Date: Thu, 5 Feb 2026 17:52:49 +0100 Subject: [PATCH] test: add Windows nvm4w path detection test Verifies that nvm4w Node.js installation paths are properly included in the expanded PATH environment on Windows, ensuring OpenCode and other npm-installed tools are detected correctly. --- src/__tests__/main/agents/path-prober.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/__tests__/main/agents/path-prober.test.ts b/src/__tests__/main/agents/path-prober.test.ts index 816cc7a6..e0d028da 100644 --- a/src/__tests__/main/agents/path-prober.test.ts +++ b/src/__tests__/main/agents/path-prober.test.ts @@ -63,6 +63,21 @@ describe('path-prober', () => { } }); + it('should include nvm4w and npm paths on Windows', () => { + const originalPlatform = process.platform; + Object.defineProperty(process, 'platform', { value: 'win32', configurable: true }); + + try { + const env = getExpandedEnv(); + // Check for nvm4w paths (OpenCode commonly installed here) + expect(env.PATH).toContain('C:\\nvm4w\\nodejs'); + // Check for npm global paths + expect(env.PATH).toMatch(/AppData[\\\/](npm|Roaming[\\\/]npm)/); + } finally { + Object.defineProperty(process, 'platform', { value: originalPlatform, configurable: true }); + } + }); + it('should preserve existing PATH entries', () => { const originalPath = process.env.PATH; const testPath = '/test/custom/path';