diff --git a/packages/pds/test/conformance.test.ts b/packages/pds/test/conformance.test.ts index a14ce7e4..61d3a26e 100644 --- a/packages/pds/test/conformance.test.ts +++ b/packages/pds/test/conformance.test.ts @@ -25,7 +25,8 @@ describe("conformance suite vs the integrated PDS", () => { it( "passes the operator-tier and discovery checks, blobs included", { - // The catalogue runs ~10s alone; leave room for a loaded machine. + // ~3s; the catalogue makes ~1000 requests, so allow for a slow + // machine. timeout: 60_000, }, async () => { diff --git a/packages/pds/test/helpers.ts b/packages/pds/test/helpers.ts index 925b1fce..1dbb8d62 100644 --- a/packages/pds/test/helpers.ts +++ b/packages/pds/test/helpers.ts @@ -1,16 +1,24 @@ /** * Test helpers with properly typed env */ -import { env as _env, exports } from "cloudflare:workers"; +import { env as _env } from "cloudflare:workers"; +import { createExecutionContext } from "cloudflare:test"; export { runInDurableObject } from "cloudflare:test"; +import app from "../src/index"; import type { PDSEnv } from "../src/types"; // Re-export env with correct type for tests export const env = _env as PDSEnv; -// Worker fetch using exports.default -export const worker = ( - exports as { - default: { fetch: (request: Request, env: PDSEnv) => Promise }; - } -).default; +/** + * The worker under test, called directly with a fresh ExecutionContext per + * request. Not through the `exports.default` loopback: every loopback call + * left the next one slower (1000 requests took a trivial 404 from ~1ms to + * ~190ms), which made the suite quadratic and timed out the conformance + * run in CI. waitUntil work is left running, as in production. + */ +export const worker = { + fetch(request: Request, env: PDSEnv): Promise { + return Promise.resolve(app.fetch(request, env, createExecutionContext())); + }, +};