Files
deepseek-harness/apps/desktop/tests/desktop-cli.spec.ts
T
yudshj 498d436db5 fix(office): 技能文件缺失时不再阻止 Desktop Host 启动,Office 改由 Desktop profile 挂载
- skill-office 在技能文件缺失或元数据解析失败时降级为持久失败,不再阻止 Desktop Host 启动
- Office 改由 Desktop profile 的 yaml 挂载,载体路径由 Desktop 壳通过 Host 环境传入
- 升级 LibreOffice Kit 到 rc.4,移除 Desktop Host 的引擎钩子,runtimeArchivePath 内联到 cli.ts 并删除 office-engine.ts
- 按平台原生路径和当前 Host 参数布局更新 web-app 与 desktop-host 测试夹具
2026-11-04 18:17:57 +08:00

41 lines
1.5 KiB
TypeScript

/** The installed CLI uses the shared pnpm distribution with Electron's package-operation environment. */
import { delimiter, join } from 'node:path'
import { afterEach, expect, it, vi } from 'vitest'
import { runCli } from '@deepseek-ai/dsh/lib/bin.js'
import { runDesktopCli, runtimeArchivePath } from '../../desktop-host/src/cli.ts'
vi.mock('@deepseek-ai/dsh/lib/bin.js', () => ({ runCli: vi.fn() }))
afterEach(() => {
vi.unstubAllEnvs()
vi.clearAllMocks()
})
it.each(['system-bin', undefined])('dispatches with bundled pnpm when PATH is %s', async (path) => {
vi.stubEnv('PATH', path)
const support = join('Application 中文 with spaces', 'resources', 'runtime')
await runDesktopCli(support)
expect(runCli).toHaveBeenCalledExactlyOnceWith({
manageDesktopProfile: true,
packageManager: {
command: process.execPath,
args: ['--expose-internals', join(support, 'primary-runtime', 'dependencies', 'pnpm', 'bin', 'pnpm.mjs')],
env: {
ELECTRON_RUN_AS_NODE: '1',
DSH_DESKTOP_NODE_EXECUTABLE: process.execPath,
PATH: `${join(support, 'bin')}${delimiter}${path ?? ''}`,
},
},
})
})
it('locates the archive of an ASAR-contained runtime and leaves a prepared runtime without one', () => {
const resources = join('Application 中文', 'resources')
expect(runtimeArchivePath(join(resources, 'app.asar', 'dsh'))).toBe(join(resources, 'app.asar'))
expect(runtimeArchivePath(join(resources, 'app.asar.unpacked', 'dsh'))).toBeUndefined()
expect(runtimeArchivePath(join(resources, 'dsh'))).toBeUndefined()
})