fix: add clearer ripgrep install guidance
This commit is contained in:
27
src/utils/ripgrep.test.ts
Normal file
27
src/utils/ripgrep.test.ts
Normal 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')
|
||||
})
|
||||
Reference in New Issue
Block a user