feat: zod v4 with backwards compatibility for v3.25+ (#1040)

This commit is contained in:
Devin Clark 2025-11-19 12:24:53 -08:00 • committed by GitHub
commit 418b7f9b85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,7 +6,7 @@ import { StreamableHTTPClientTransport } from '../client/streamableHttp.js';
import { McpServer } from '../server/mcp.js';
import { StreamableHTTPServerTransport } from '../server/streamableHttp.js';
import { CallToolResultSchema, LoggingMessageNotificationSchema } from '../types.js';
import { z } from 'zod';
import * as z from 'zod/v4';
import { InMemoryEventStore } from '../examples/shared/inMemoryEventStore.js';
describe('Transport resumability', () => {
@ -193,8 +193,14 @@ describe('Transport resumability', () => {
}
);
// Wait for some notifications to arrive (not all) - shorter wait time
await new Promise(resolve => setTimeout(resolve, 20));
// Fix for node 18 test failures, allow some time for notifications to arrive
const maxWaitTime = 2000; // 2 seconds max wait
const pollInterval = 10; // Check every 10ms
const startTime = Date.now();
while (notifications.length === 0 && Date.now() - startTime < maxWaitTime) {
// Wait for some notifications to arrive (not all) - shorter wait time
await new Promise(resolve => setTimeout(resolve, pollInterval));
}
// Verify we received some notifications and lastEventId was updated
expect(notifications.length).toBeGreaterThan(0);