Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

995 B
Raw Blame
import { expect, it, vi } from 'vitest'
import { opencodeBin, opencodeBinAsync } from '../lib/engineBin.js'

vi.mock('../lib/engineBin.js', () => ({
  opencodeBin: vi.fn(() => { throw new Error('a native command was resolved during import') }),
  opencodeBinAsync: vi.fn(() => { throw new Error('a native command was resolved during import') }),
}))
vi.mock('./inProcess.js', () => ({ loadEngine: vi.fn(() => { throw new Error('optional code was loaded during import') }) }))

it('imports native control without probing an executable, reading a store or loading interpretation', async () => {
  const control = await import('./launchControl.js')
  expect(control.parseOpencodeMajor('opencode v2.0.18')).toBe(2)
  expect(control.parseOpencodeModelId('fixture/model')).toEqual({ providerID: 'fixture', modelID: 'model' })
  expect(opencodeBin).not.toHaveBeenCalled()
  expect(opencodeBinAsync).not.toHaveBeenCalled()
  expect((await import('./inProcess.js')).loadEngine).not.toHaveBeenCalled()
})