jevstrudel.git / worker / test / cloudflare-workers.ts
1// `cloudflare:workers` for vitest, which runs the Worker's tests in Node,
2// where that module does not exist (vitest.config.mjs aliases it here). The
3// Worker's own Durable Objects are tested through their plain-code halves
4// (party-room.ts, tab-hub-core.ts, budget-counter.ts), but modules that
5// import one (index.ts) and @cloudflare/workers-oauth-provider, which
6// 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}
13
14export class WorkerEntrypoint<Env = unknown> {
15  constructor(
16    protected ctx: unknown,
17    protected env: Env,
18  ) {}
19}