

























@@ -106,9 +106,7 @@ async function expectAcceptedWorkspace(params: { agentId: string; expectedWorksp
106106);
107107108108expect(result.status).toBe("accepted");
109-expect(getRegisteredRun()).toMatchObject({
110-workspaceDir: params.expectedWorkspaceDir,
111-});
109+expect(getRegisteredRun()?.workspaceDir).toBe(params.expectedWorkspaceDir);
112110}
113111114112describe("spawnSubagentDirect workspace inheritance", () => {
@@ -188,10 +186,8 @@ describe("spawnSubagentDirect workspace inheritance", () => {
188186lightContext: true,
189187});
190188191-expect(agentParams).toMatchObject({
192-bootstrapContextMode: "lightweight",
193-bootstrapContextRunKind: "default",
194-});
189+expect(agentParams?.bootstrapContextMode).toBe("lightweight");
190+expect(agentParams?.bootstrapContextRunKind).toBe("default");
195191});
196192197193it("omits bootstrap context flags for default subagent spawns", async () => {
@@ -235,19 +231,15 @@ describe("spawnSubagentDirect workspace inheritance", () => {
235231},
236232);
237233238-expect(result).toMatchObject({
239-status: "error",
240-error: "spawn startup failed",
241-});
234+expect(result.status).toBe("error");
235+expect(result.error).toBe("spawn startup failed");
242236expect(result.childSessionKey).toMatch(/^agent:main:subagent:/);
243237expect(hoisted.registerSubagentRunMock).not.toHaveBeenCalled();
244238245239const deleteCall = findLastSessionDeleteCall();
246-expect(deleteCall?.params).toMatchObject({
247-key: result.childSessionKey,
248-deleteTranscript: true,
249-emitLifecycleHooks: false,
250-});
240+expect(deleteCall?.params?.key).toBe(result.childSessionKey);
241+expect(deleteCall?.params?.deleteTranscript).toBe(true);
242+expect(deleteCall?.params?.emitLifecycleHooks).toBe(false);
251243});
252244253245it("keeps lifecycle hooks enabled when registerSubagentRun fails after thread binding succeeds", async () => {
@@ -293,18 +285,14 @@ describe("spawnSubagentDirect workspace inheritance", () => {
293285},
294286);
295287296-expect(result).toMatchObject({
297-status: "error",
298-error: "Failed to register subagent run: registry unavailable",
299-childSessionKey: expect.stringMatching(/^agent:main:subagent:/),
300-runId: "run-thread-register-fail",
301-});
288+expect(result.status).toBe("error");
289+expect(result.error).toBe("Failed to register subagent run: registry unavailable");
290+expect(result.childSessionKey).toMatch(/^agent:main:subagent:/);
291+expect(result.runId).toBe("run-thread-register-fail");
302292303293const deleteCall = findLastSessionDeleteCall();
304-expect(deleteCall?.params).toMatchObject({
305-key: result.childSessionKey,
306-deleteTranscript: true,
307-emitLifecycleHooks: true,
308-});
294+expect(deleteCall?.params?.key).toBe(result.childSessionKey);
295+expect(deleteCall?.params?.deleteTranscript).toBe(true);
296+expect(deleteCall?.params?.emitLifecycleHooks).toBe(true);
309297});
310298});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。