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.
This commit is contained in:
chr1syy
2026-02-05 17:52:49 +01:00
parent 32e4fc33a6
commit e65266f8d9

View File

@@ -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', () => { it('should preserve existing PATH entries', () => {
const originalPath = process.env.PATH; const originalPath = process.env.PATH;
const testPath = '/test/custom/path'; const testPath = '/test/custom/path';