โก
In-Process Testing
Your bot runs entirely in-process. No Telegram token, no network round-trips, no flaky timeouts. Tests are deterministic and fast.
Drive your real bot in-process. Capture every API call. Assert on replies โ no tokens, no network, no waiting.
import { prepareBot } from 'grammy-testing';
import { Bot } from 'grammy';
import { describe, expect, it } from 'vitest';
const bot = new Bot('token');
bot.command('start', (ctx) => ctx.reply('Hello!'));
it('replies to /start', async () => {
const { chats } = await prepareBot(bot);
const user = chats.newUser();
await user.sendCommand('/start');
expect(user.replies.lastOrThrow().text).toBe('Hello!');
});npm install --save-dev grammy-testingyarn add --dev grammy-testingpnpm add --save-dev grammy-testingimport { prepareBot } from 'npm:grammy-testing';