jevstrudel.git / worker / test / cloudflare-workers.ts

cloudflare:workers for vitest, which runs the Worker's tests in Node, where that module does not exist (vitest.config.mjs aliases it here). The Worker's own Durable Objects are tested through their plain-code halves (party-room.ts, tab-hub-core.ts, budget-counter.ts), but modules that import one (index.ts) and @cloudflare/workers-oauth-provider, which imports WorkerEntrypoint, load in Node with these stand-ins.

7export class DurableObject<Env = unknown> {
8  constructor(
9    protected ctx: unknown,
10    protected env: Env,
11  ) {}
12}
14export class WorkerEntrypoint<Env = unknown> {
15  constructor(
16    protected ctx: unknown,
17    protected env: Env,
18  ) {}
19}