Skip to content

Commit 7a0570e

Browse files
A.R.claude
andcommitted
test(mcp): align legacy attach.test.js with Task 2.2 contract
The pre-existing daemon/attach.test.js had a case asserting the OLD attachToDaemon behavior (rejection IS the original error). After Task 2.2, attachToDaemon now wraps the underlying error in DaemonAttachError with the original preserved as `cause`. Updated the assertion to match the new contract — same shape as the new daemon-attach.test.ts but exercised through the legacy test's setup. Caught by `npm test` after the 0.8.41 release commit; no new code change needed beyond aligning the existing assertion. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7ba92fc commit 7a0570e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

packages/mcp-server/test/daemon/attach.test.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,14 @@ describe("daemon attach", () => {
117117
expect(warning.endsWith("\n")).toBe(true);
118118
});
119119

120-
it("rejects with the underlying error when fallbackStdio is false and daemon cannot start", async () => {
120+
it("rejects with DaemonAttachError when fallbackStdio is false and daemon cannot start", async () => {
121121
const ensureError = new Error("no daemon here");
122122
let mainCalls = 0;
123123

124+
// Task 2.2: attachToDaemon now wraps the underlying error in
125+
// DaemonAttachError when fallbackStdio is false (the new default).
126+
// The underlying error is preserved as `cause`; the bare-Error
127+
// contract is gone.
124128
await expect(
125129
attachToDaemon({
126130
configDir,
@@ -136,7 +140,11 @@ describe("daemon attach", () => {
136140
},
137141
},
138142
}),
139-
).rejects.toBe(ensureError);
143+
).rejects.toMatchObject({
144+
name: "DaemonAttachError",
145+
code: "DAEMON_UNREACHABLE",
146+
cause: ensureError,
147+
});
140148
expect(mainCalls).toBe(0);
141149
});
142150
});

0 commit comments

Comments
 (0)