28 lines
969 B
TypeScript
28 lines
969 B
TypeScript
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')
|
|
})
|