Introduction
A complete, runner-agnostic testing suite for Seyfert bots — from a single run() to your whole bot running in-process, never touching Discord.
@slipher/testing is a complete, runner-agnostic testing suite for Seyfert bots and Slipher plugins. It runs your bot — or any slice of it — entirely in-process: no token, no gateway, no network, never talking to Discord. It bundles no runner of its own; bring whichever you use (Vitest, Jest, node:test, …).
Most Discord bots are hard to test at all — running one means opening a gateway connection to Discord, so commands, components, and events have nowhere to run in a plain unit test. Making a bot testable entirely in-process, without that requirement, is the primary idea behind this package. It's an active effort tackling that problem head-on, so expect the API to keep evolving across upcoming versions.
How it works
The mock bot is the core. It drives a real Seyfert client pipeline in-process — your actual commands, middlewares, and plugins — dispatching raw payloads through the same HandleCommand → resolver → middleware flow production uses, while capturing every outgoing REST call for assertions instead of sending it. You're testing the bot you ship, not a reimplementation of it.
The fixture layer is the lightweight counterpart: plain mock objects with no assertions, spies, or fake timers bundled, so they stay runner-agnostic. The core is mockCommandContext() — a stand-in for a Seyfert command context with the fields most commands touch, plus working Slipher stubs (logger, queues, scheduler) that record what your command does so you can assert on it afterward. Factories (mockUser, mockGuild, …) build the entities, with deterministic ids you can override.
Rule of thumb: testing real behavior — option parsing, middlewares, permissions, components, REST, events — → mock bot; testing a single run() body in isolation → fixtures. Both come from the same import and coexist in one suite.
Install
pnpm add -D @slipher/testingRequires Seyfert v5 (peer dependency).
Where to go next
The suite is split into two parts:
- Writing Tests — a hands-on walkthrough. Set up the mock bot, then test commands, events, components, and modals step by step. Start here if you're new.
- Toolkit — the reference for every piece: Mock bot · Dispatching · World & State · Assertions · MockGateway · Fixtures · Defaults & Scope