DSH: OpenSpec — проектные скиллы, --openspec, проверка (#42) #60
@ -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)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user