Block Kit validation and SDK mocking. Catch invalid blocks before they reach Slack. Unit test your handlers without a real workspace or token.
npm install botlint-slack --save-dev
Block Kit validation
The metadata gets silently dropped. Your message appears as plain text. No error. No warning. botlint-slack validates your blocks offline — before the API ever sees them — with exact error messages including character counts and indices.
SDK mocking
createMockClient() is a drop-in replacement for app.client in Bolt handlers. Records every API call so you can assert on exactly what your bot sent. Zero network calls, zero credentials, runs in milliseconds.
Everything you need to start testing your Slack bot today.
Validates Slack Block Kit structures offline without hitting the API. Accepts arrays of blocks, single block objects, modal views, or home tab views. Always returns { valid: boolean, errors: string[] } — never throws.
Returns a mock object with four properties. Pass mock.client wherever your handler expects app.client. All methods resolve immediately with { ok: true }.
Custom matchers for cleaner assertions. Register once in your Jest setup file, then use across all tests.
jest.config.js
jest.setup.js
botlint-slack validates all core Block Kit block types against Slack's actual constraints. All types also check block_id uniqueness and max length of 255 chars.
All methods are async and return resolved promises. No network calls are made. Calls are recorded in both flat and nested forms.
mock.calls['chat.postMessage'] or mock.calls.chat.postMessage"It would be very convenient if this library included a utility for validating blocks. Currently, blocks are a bit brittle — changes can produce errors which can only be debugged interactively through a dummy Slack channel."
"I cannot find any framework pointers, or documentation, on how I would write reasonable unit tests for this."
"At this moment, there is no built-in support for testing your code using this SDK."
V1 is live. V2 and V3 are gated on community traction — watch download numbers for 4–6 weeks after launch.
Catch Block Kit errors before they ship. Unit test your handlers in milliseconds. No token, no workspace, no drama.