fix(dsh): тест --check без openspec ищет bash через системный PATH (#42)

Co-Authored-By: DeepSeek Harness <noreply@deepseek.com>
This commit is contained in:
Andrey Epifancev 2026-10-24 19:22:08 +04:00
parent 9ecc3eb793
commit 5d0fdc4c0d

View File

@ -1,6 +1,6 @@
import assert from 'node:assert/strict'
import { spawnSync } from 'node:child_process'
import { chmodSync, existsSync, readFileSync } from 'node:fs'
import { chmodSync, existsSync, mkdirSync, readFileSync, symlinkSync } from 'node:fs'
import { dirname, join } from 'node:path'
import test from 'node:test'
import { fileURLToPath } from 'node:url'
@ -50,10 +50,18 @@ test('install.sh --check warns but does not fail without the openspec CLI', () =
const home = tempDir()
try {
const bin = join(home, 'bin')
const env = { ...process.env, HOME: home, DSH_HOME: join(home, '.dsh'), PATH: bin }
mkdirSync(bin, { recursive: true })
symlinkSync(process.execPath, join(bin, 'node'))
// openspec ставится в /opt/homebrew/bin; здесь только системные каталоги — CLI не найден
const env = {
...process.env,
HOME: home,
DSH_HOME: join(home, '.dsh'),
PATH: `${bin}:/usr/bin:/bin:/usr/sbin:/sbin`,
}
const run = spawnSync('bash', [script, '--check'], { env, encoding: 'utf8' })
assert.equal(run.status, 0, run.stderr)
assert.match(run.stdout + run.stderr, /WARN: openspec not found/)
assert.equal(run.status, 0)
} finally {
cleanup(home)
}