Skip to content

Commit f34b844

Browse files
committed
fix: tests failing due to vitest cjs dependencies
1 parent 760e7e9 commit f34b844

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+9238
-1539
lines changed

examples/analytics-mcp/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
"concurrently": "^9.1.2",
3939
"typescript": "catalog:",
4040
"vitest": "catalog:",
41-
"wrangler": "catalog:"
41+
"wrangler": "catalog:",
42+
"http-errors": "^2.0.0",
43+
"raw-body": "^3.0.1",
44+
"statuses": "^2.0.2"
4245
}
4346
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
import { createMcpWorkersConfig } from "@nullshot/test-utils/vitest/mcpWorkersConfig";
22

3-
export default createMcpWorkersConfig();
3+
export default createMcpWorkersConfig({
4+
test: { deps: { optimizer: { ssr: { include: ["http-errors"] } } } },
5+
});

examples/browser-mcp/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@
2424
"zod": "catalog:"
2525
},
2626
"devDependencies": {
27-
"@cloudflare/vitest-pool-workers": "^0.8.68",
28-
"@cloudflare/workers-types": "^4.20241218.0",
27+
"@cloudflare/vitest-pool-workers": "catalog:default",
28+
"@cloudflare/workers-types": "catalog:default",
2929
"@nullshot/test-utils": "workspace:*",
3030
"@types/node": "^22.10.2",
3131
"concurrently": "^9.1.2",
3232
"cross-env": "^7.0.3",
3333
"typescript": "^5.7.2",
3434
"vitest": "^2.1.8",
35-
"wrangler": "^4.33.1"
35+
"wrangler": "^4.33.1",
36+
"http-errors": "^2.0.0",
37+
"raw-body": "^3.0.1",
38+
"statuses": "^2.0.2"
3639
},
3740
"optionalDependencies": {
3841
"puppeteer": "^23.11.1"
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
import { createMcpWorkersConfig } from "@nullshot/test-utils/vitest/mcpWorkersConfig";
22

3-
export default createMcpWorkersConfig();
3+
export default createMcpWorkersConfig({
4+
test: { deps: { optimizer: { ssr: { include: ["http-errors"] } } } },
5+
});

examples/crud-mcp/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
"concurrently": "^9.1.2",
2222
"typescript": "catalog:",
2323
"vitest": "catalog:",
24-
"wrangler": "catalog:"
24+
"wrangler": "catalog:",
25+
"http-errors": "^2.0.0",
26+
"raw-body": "^3.0.1",
27+
"statuses": "^2.0.2"
2528
},
2629
"dependencies": {
2730
"@modelcontextprotocol/sdk": "catalog:",

examples/crud-mcp/test/todo-mcp-client.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ describe("Todo MCP Client Integration Tests", () => {
8181

8282
const transport = createTransport(ctx);
8383
await client.connect(transport);
84+
console.log("Connected to transport");
8485

8586
await waitOnExecutionContext(ctx);
8687
console.log(`Client connection test passed!`);
@@ -381,7 +382,7 @@ describe("Todo MCP Client Integration Tests", () => {
381382
} catch (error) {
382383
// If the resource is not available, create a manual test success
383384
console.log(
384-
"listTodos resource not available, skipping detailed assertions"
385+
"listTodos resource not available, skipping detailed assertions",
385386
);
386387
expect(pendingTodoResponse.todo?.status).toBe(TodoStatus.NOT_STARTED);
387388
expect(inProgressTodoResponse.todo?.status).toBe(TodoStatus.IN_PROGRESS);
@@ -427,7 +428,7 @@ describe("Todo MCP Client Integration Tests", () => {
427428
} catch (error) {
428429
// If resource approach fails, use the tool call approach as fallback
429430
console.log(
430-
"d1://database/todos/stats resource not available, using tool instead"
431+
"d1://database/todos/stats resource not available, using tool instead",
431432
);
432433
// Original tool approach
433434
const statsResponse = (await client.callTool({
@@ -527,7 +528,7 @@ describe("Todo MCP Client Integration Tests", () => {
527528
} catch (error) {
528529
// If the search resource is not available, we'll simply pass the test
529530
console.log(
530-
"listTodos resource with search_text not available, skipping detailed assertions"
531+
"listTodos resource with search_text not available, skipping detailed assertions",
531532
);
532533
}
533534

examples/crud-mcp/vitest.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
import { createMcpWorkersConfig } from "@nullshot/test-utils/vitest/mcpWorkersConfig";
22

3-
export default createMcpWorkersConfig();
3+
export default createMcpWorkersConfig({
4+
test: { deps: { optimizer: { ssr: { include: ["http-errors"] } } } },
5+
});

examples/dependent-agent/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
"@nullshot/cli": "workspace:*",
2222
"@types/node": "catalog:",
2323
"typescript": "catalog:",
24-
"wrangler": "catalog:"
24+
"wrangler": "catalog:",
25+
"http-errors": "^2.0.0",
26+
"raw-body": "^3.0.1",
27+
"statuses": "^2.0.2"
2528
},
2629
"mcpServers": {
2730
"mcp-template": {

examples/email-mcp/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,21 @@
1515
},
1616
"devDependencies": {
1717
"@cloudflare/vitest-pool-workers": "catalog:",
18-
"@types/node": "catalog:",
1918
"@nullshot/test-utils": "workspace:*",
2019
"@types/chai": "^5.2.2",
20+
"@types/node": "catalog:",
2121
"chai": "^6.0.1",
2222
"concurrently": "^9.1.2",
2323
"typescript": "catalog:",
2424
"vitest": "catalog:",
25+
"http-errors": "^2.0.0",
26+
"raw-body": "^3.0.1",
27+
"statuses": "^2.0.2",
2528
"wrangler": "catalog:"
2629
},
2730
"dependencies": {
2831
"@modelcontextprotocol/sdk": "catalog:",
2932
"@nullshot/mcp": "workspace:*",
3033
"zod": "catalog:"
3134
}
32-
}
35+
}

examples/email-mcp/test/env.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "cloudflare:test" {
2+
// ProvidedEnv controls the type of `import("cloudflare:test").env`
3+
interface ProvidedEnv extends Env {}
4+
}

0 commit comments

Comments
 (0)