fix: add clearer ripgrep install guidance

This commit is contained in:
Vasanthdev2004
2026-04-02 10:19:36 +05:30
parent 1a60509fdc
commit 2bade922ef
3 changed files with 88 additions and 3 deletions

27
src/utils/ripgrep.test.ts Normal file
View File

@@ -0,0 +1,27 @@
import { expect, test } from 'bun:test'
import { wrapRipgrepUnavailableError } from './ripgrep.ts'
test('wrapRipgrepUnavailableError explains missing packaged fallback', () => {
const error = wrapRipgrepUnavailableError(
{ code: 'ENOENT', message: 'spawn rg ENOENT' },
{ mode: 'builtin', command: 'C:\\fake\\vendor\\ripgrep\\rg.exe' },
'win32',
)
expect(error.name).toBe('RipgrepUnavailableError')
expect(error.code).toBe('ENOENT')
expect(error.message).toContain('packaged ripgrep fallback')
expect(error.message).toContain('winget install BurntSushi.ripgrep.MSVC')
})
test('wrapRipgrepUnavailableError explains missing system ripgrep', () => {
const error = wrapRipgrepUnavailableError(
{ code: 'ENOENT', message: 'spawn rg ENOENT' },
{ mode: 'system', command: 'rg' },
'linux',
)
expect(error.message).toContain('system ripgrep binary was not found on PATH')
expect(error.message).toContain('apt install ripgrep')
})