Skip to content

Commit 900bdb6

Browse files
committed
test(integration): drop pre-installed @cfworker/json-schema from CF Workers test
PR #2088 adds @cfworker/json-schema to noExternal so the validator is bundled into the published @modelcontextprotocol/server tarball. The Cloudflare Workers integration test was still installing the package as a direct dep in the generated consumer package.json, which masked any future re-externalization regression — wrangler would resolve the bare import from the test's own install instead of failing. Removing the dep turns the test into a true regression guard that the bundle is genuinely self-contained, matching the migration docs. Closes the last open review thread on #2088.
1 parent 44e7b26 commit 900bdb6

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

test/integration/test/server/cloudflareWorkers.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ describe('Cloudflare Workers compatibility (no nodejs_compat)', () => {
4242
private: true,
4343
type: 'module',
4444
dependencies: {
45-
'@modelcontextprotocol/server': `file:./${tarballName}`,
46-
'@cfworker/json-schema': '^4.1.1'
45+
'@modelcontextprotocol/server': `file:./${tarballName}`
4746
},
4847
devDependencies: {
4948
wrangler: '^4.14.4'
@@ -150,28 +149,29 @@ export default {
150149
it('should handle MCP requests', async () => {
151150
expect(env).not.toBeNull();
152151

153-
// Retry connection — wrangler may report "Ready" before it can handle requests
154-
let client!: Client;
152+
// Wrangler may report "Ready" before miniflare can fully service the user worker.
153+
// `connect()` can succeed against the entry worker while the first real request still
154+
// gets a 500 ("Network connection lost"), so both have to be retried together with a
155+
// fresh client per attempt.
155156
let lastError: unknown;
156157
for (let attempt = 0; attempt < 5; attempt++) {
158+
const client = new Client({ name: 'test-client', version: '1.0.0' });
157159
try {
158-
client = new Client({ name: 'test-client', version: '1.0.0' });
159160
const transport = new StreamableHTTPClientTransport(new URL(`http://127.0.0.1:${PORT}/`));
160161
await client.connect(transport);
162+
const result = await client.callTool({ name: 'greet', arguments: { name: 'World' } });
163+
expect(result.content).toEqual([{ type: 'text', text: 'Hello, World!' }]);
164+
await client.close();
161165
lastError = undefined;
162166
break;
163167
} catch (error) {
164168
lastError = error;
169+
await client.close().catch(() => {});
165170
await new Promise(resolve => setTimeout(resolve, 1000));
166171
}
167172
}
168173
if (lastError) {
169174
throw lastError;
170175
}
171-
172-
const result = await client.callTool({ name: 'greet', arguments: { name: 'World' } });
173-
expect(result.content).toEqual([{ type: 'text', text: 'Hello, World!' }]);
174-
175-
await client.close();
176176
}, 30_000);
177177
});

0 commit comments

Comments
 (0)