Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106import { describe, expect, it,} from '@monochromatic-dev/module-test/ts';
import { EditorCommandError, resolveEditorCommand,} from '../dist/final/node/index.mjs';
await describe({ name: resolveEditorCommand.name, children: [ it({ name: 'prefers user config over VISUAL and EDITOR', fn: async () => { expect(resolveEditorCommand({ configuredEditor: 'nano --nowrap', env: { VISUAL: 'code --wait', EDITOR: 'hx', }, platform: 'linux', },),) .toEqual([ 'nano', '--nowrap', ],); }, },), it({ name: 'prefers VISUAL with configured arguments', fn: async () => { expect(resolveEditorCommand({ env: { VISUAL: 'code --wait', EDITOR: 'hx', }, platform: 'linux', },),) .toEqual([ 'code', '--wait', ],); }, },), it({ name: 'uses EDITOR when VISUAL is blank', fn: async () => { expect(resolveEditorCommand({ env: { VISUAL: ' ', EDITOR: 'hx "--working-dir=/tmp/a b"', }, platform: 'linux', },),) .toEqual([ 'hx', '--working-dir=/tmp/a b', ],); }, },), it({ name: 'uses vi fallback outside Windows', fn: async () => { expect(resolveEditorCommand({ env: {}, platform: 'linux', },),) .toEqual(['vi',],); }, },), it({ name: 'uses notepad fallback on Windows', fn: async () => { expect(resolveEditorCommand({ env: {}, platform: 'win32', },),) .toEqual(['notepad.exe',],); }, },), it({ name: 'rejects unsupported shell syntax', fn: async () => { /** Captured editor configuration failure. */ const caught: { value?: unknown; } = {}; try { resolveEditorCommand({ env: { EDITOR: 'hx; other-command', }, platform: 'linux', },); } catch (error: unknown) { caught.value = error; } expect(caught.value,) .toBeInstanceOf(EditorCommandError,); }, },), ],},);