|
|
@@ -1,4 +1,4 @@
|
|
|
-import { copyFile, mkdir, readFile, readdir, writeFile } from 'node:fs/promises'
|
|
|
+import { readFile, readdir, writeFile } from 'node:fs/promises'
|
|
|
import { createServer } from 'node:http'
|
|
|
import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
|
import { delimiter, dirname, join } from 'node:path'
|
|
|
@@ -59,7 +59,6 @@ const deepseekDefaultsConfigPath = fileURLToPath(new URL('./fixtures/deepseek-de
|
|
|
const headlessOverlayPath = fileURLToPath(new URL('./fixtures/headless-profile.cordis.yml', import.meta.url))
|
|
|
const headlessSessionExpected = join(snapshotsDir, 'headless-profile', 'session.expected.jsonl')
|
|
|
const headlessFailureExpected = join(snapshotsDir, 'headless-profile', 'stderr.expected.txt')
|
|
|
-const cliMockLlmPluginPath = fileURLToPath(new URL('./fixtures/cli-mock-llm.ts', import.meta.url))
|
|
|
const refreshing = process.env.DSH_SNAPSHOT === 'refresh'
|
|
|
|
|
|
interface JsonObject {
|
|
|
@@ -232,16 +231,6 @@ async function persistedLogs(cwd: string, root: string = join(cwd, '.sessions'))
|
|
|
}))
|
|
|
}
|
|
|
|
|
|
-/** Install the keyless product-CLI adapter into the temporary headless profile. */
|
|
|
-async function prepareCliMockFixture(cwd: string): Promise<void> {
|
|
|
- const fixtureDir = join(cwd, '.dsh', 'profiles', 'headless', 'snapshot-fixtures')
|
|
|
- await mkdir(fixtureDir, { recursive: true })
|
|
|
- await Promise.all([
|
|
|
- copyFile(cliMockLlmPluginPath, join(fixtureDir, 'cli-mock-llm.ts')),
|
|
|
- writeFile(join(fixtureDir, 'package.json'), '{"type":"module"}\n'),
|
|
|
- ])
|
|
|
-}
|
|
|
-
|
|
|
describe('headless stream-json snapshots', () => {
|
|
|
it('runs one task through the product headless profile command', async () => {
|
|
|
const task = 'Prove the product headless profile path with one real tool round trip.'
|
|
|
@@ -257,7 +246,6 @@ describe('headless stream-json snapshots', () => {
|
|
|
DSH_TELEMETRY_DISABLED: '1',
|
|
|
NODE_OPTIONS: [process.env.NODE_OPTIONS, '--disable-warning=ExperimentalWarning'].filter(Boolean).join(' '),
|
|
|
},
|
|
|
- prepare: prepareCliMockFixture,
|
|
|
inspect: async (cwd) => {
|
|
|
const logs = await persistedLogs(cwd, join(cwd, '.dsh', 'sessions'))
|
|
|
expect(logs).toHaveLength(1)
|
|
|
@@ -290,7 +278,6 @@ describe('headless stream-json snapshots', () => {
|
|
|
DSH_TELEMETRY_DISABLED: '1',
|
|
|
NODE_OPTIONS: [process.env.NODE_OPTIONS, '--disable-warning=ExperimentalWarning'].filter(Boolean).join(' '),
|
|
|
},
|
|
|
- prepare: prepareCliMockFixture,
|
|
|
})
|
|
|
|
|
|
expect(result.stdout).toBe('\n')
|