fix(dsh): тест --check без openspec ищет bash через системный PATH (#42)
Co-Authored-By: DeepSeek Harness <noreply@deepseek.com>
This commit is contained in:
parent
9ecc3eb793
commit
5d0fdc4c0d
@ -1,6 +1,6 @@
|
|||||||
import assert from 'node:assert/strict'
|
import assert from 'node:assert/strict'
|
||||||
import { spawnSync } from 'node:child_process'
|
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 { dirname, join } from 'node:path'
|
||||||
import test from 'node:test'
|
import test from 'node:test'
|
||||||
import { fileURLToPath } from 'node:url'
|
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()
|
const home = tempDir()
|
||||||
try {
|
try {
|
||||||
const bin = join(home, 'bin')
|
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' })
|
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.match(run.stdout + run.stderr, /WARN: openspec not found/)
|
||||||
assert.equal(run.status, 0)
|
|
||||||
} finally {
|
} finally {
|
||||||
cleanup(home)
|
cleanup(home)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user