Ver código fonte

test(acp-snapshot): cover pre-spawn launch failure

Tianyi Cui 2 meses atrás
pai
commit
e846a115f2
1 arquivos alterados com 17 adições e 0 exclusões
  1. 17 0
      packages/support/acp-snapshot/tests/harness.spec.ts

+ 17 - 0
packages/support/acp-snapshot/tests/harness.spec.ts

@@ -244,6 +244,23 @@ describe('runScenario', () => {
     )).rejects.toThrow(/agent stderr:\nfake agent requested startup failure/)
   })
 
+  it('preserves launch-resolution errors when no child process exists', async () => {
+    const { dir, fixtureFile } = await scenario({})
+    vi.stubEnv('DSH_EXAMPLE_MODE', 'lib')
+    try {
+      await expect(runScenario(
+        { steps: [] },
+        {
+          agent: { ...AGENT, binScript: join(dir, 'outside-src.ts'), libBinScript: undefined },
+          mode: 'replay',
+          fixtureFile,
+        },
+      )).rejects.toThrow(/expected a "\/src\/" segment/)
+    } finally {
+      vi.unstubAllEnvs()
+    }
+  })
+
   it('drives a full turn: initialize (terminal caps), session, prompt, permission stub, harvest', { timeout: 20_000 }, async () => {
     const { fixtureFile } = await scenario({
       permissionProbe: true,