'use strict'; const test = require('node:test'), assert = require('node:assert/strict'), path = require('node:path'), { spawnSync } = require('node:child_process'); test('DSH installer read-only check verifies the pinned installed runtime', (t) => { if (!require('../../src/modules/assistant/dsh-runtime.cjs').installedRuntime()) return t.skip('Pinned DSH runtime is not installed'); const result = spawnSync( process.execPath, [path.resolve(__dirname, '../../scripts/install-dsh-runtime.cjs'), '--check'], { encoding: 'utf8', windowsHide: true }, ); assert.equal(result.status, 0, result.stderr); const value = JSON.parse(result.stdout); assert.equal(value.version, '0.2.1-rc.2'); assert.equal(value.package, '@deepseek-ai/dsh'); assert.equal(value.available, true); assert.ok(value.runtimePath.endsWith(path.join('dsh', 'lib', 'bin.js'))); }); test('DSH installer rejects unknown options before installation', () => { const result = spawnSync( process.execPath, [path.resolve(__dirname, '../../scripts/install-dsh-runtime.cjs'), '--unsafe'], { encoding: 'utf8', windowsHide: true }, ); assert.equal(result.status, 1); assert.match(result.stderr, /Unsupported option/); });