Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/pds/test/conformance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
22 changes: 15 additions & 7 deletions packages/pds/test/helpers.ts
Original file line number Diff line number Diff line change
@@ -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<Response> };
}
).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<Response> {
return Promise.resolve(app.fetch(request, env, createExecutionContext()));
},
};
Loading