Skip to main content
The test scheduler client (SchedulerClientType.TEST, package tooling-scheduler-test) runs schedule handlers on demand in backend tests. It does not register BullMQ job schedulers and does not fire cron ticks.

Why it exists

Production uses BullMQ job schedulers in the consumer process. Backend Jest suites need the same schedule handlers without Redis, without a running consumer, and without waiting for cron. The test client is that adapter — similar to MailerClientType.LOCAL or other test doubles in the tooling system.

Behavior

Handlers live in apps/backend/src/tools/scheduler/schedules/ and are shared between both clients.

Configuration

Only apps/backend/src/configuration/test.ts:
Dev/staging/prod use SchedulerClientType.BULLMQ with connection, schedulerQueueName, schedulerTickJobName, and schedules[]. See BullMQ scheduler.

Using in tests

The handler receives { scheduleName, firedAt } and tools, same as a production tick. Use buildEnqueueJobId from shared when enqueueing from the handler. When tools.logger / tools.metrics are present, runScheduleNow emits scheduler-test logs and scheduler.run_now.* metrics (see Scheduler overview monitoring table).

Mental model

What’s next?