diff --git a/apps/mono/src/context.ts b/apps/mono/src/context.ts index 4ee09c1..bc0a700 100644 --- a/apps/mono/src/context.ts +++ b/apps/mono/src/context.ts @@ -1,4 +1,9 @@ import type { SharedHonoEnv, SharedHonoVariables } from '@repo/hono-helpers/src/types' +// Type-only import (erased at build) of the DO class this worker re-exports from its +// entry. The parameter has to be here, not just on `match`'s Env: `scheduled` hands this +// worker's superset Env straight to `matchScheduled`, and a bare `DurableObjectNamespace` +// is not assignable to the `DurableObjectNamespace` that one declares. +import type { NotificationsHub } from '../../notify/src/notifications-hub' /** * Union of every mounted worker's bindings. @@ -25,7 +30,7 @@ export type Env = SharedHonoEnv & { RECFLARE_PLAYER_SETTINGS: KVNamespace // Real-time notifications hub. The class is defined in `notify` and re-exported by // this worker's entry so the binding resolves in-process (no `script_name`). - RECFLARE_NOTIFICATIONS_HUB: DurableObjectNamespace + RECFLARE_NOTIFICATIONS_HUB: DurableObjectNamespace } export type Variables = SharedHonoVariables diff --git a/apps/mono/vitest.config.ts b/apps/mono/vitest.config.ts index de0d903..4d33f09 100644 --- a/apps/mono/vitest.config.ts +++ b/apps/mono/vitest.config.ts @@ -2,6 +2,13 @@ import { cloudflareTest } from '@cloudflare/vitest-pool-workers' import { defineConfig } from 'vitest/config' export default defineConfig({ + test: { + // The facade bundles all 13 worker apps (see mono.app.ts), so the first request in + // a run pays a cold start for the lot of it — ~3.4s even on an idle machine. The + // 5s default leaves no headroom for that, and the whole-monorepo run puts 21 + // projects on the CPU at once, which pushed these tests into flaky timeouts. + testTimeout: 30_000, + }, plugins: [ cloudflareTest({ wrangler: { configPath: `${__dirname}/wrangler.jsonc` },