refactor(platform): address code review feedback for node-finder

- Extract VERSION_DIR_PATTERN regex to named constant
- Pass logger to findNodeViaShell for consistent debug logging
- Fix buildEnhancedPath to not add trailing delimiter for empty currentPath

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Kacper
2025-12-21 15:01:32 +01:00
parent 887fb93b3b
commit b18672f66d
2 changed files with 17 additions and 6 deletions

View File

@@ -87,12 +87,12 @@ describe('node-finder', () => {
expect(result).toBe(currentPath);
});
it('should handle empty currentPath', () => {
it('should handle empty currentPath without trailing delimiter', () => {
const nodePath = '/opt/homebrew/bin/node';
const result = buildEnhancedPath(nodePath, '');
expect(result).toBe(`/opt/homebrew/bin${delimiter}`);
expect(result).toBe('/opt/homebrew/bin');
});
it('should handle Windows-style paths', () => {
@@ -118,7 +118,7 @@ describe('node-finder', () => {
const result = buildEnhancedPath(nodePath);
expect(result).toBe(`/usr/local/bin${delimiter}`);
expect(result).toBe('/usr/local/bin');
});
});
});