Keploy as a Bun testing framework
Keploy tests Bun services by recording real HTTP and database traffic from a running process, then replaying it as assertions. There is no module mock to register and nothing to mock by hand, because capture happens below the runtime at the socket.
keploy record -c "bun run index.ts"What Keploy gives a Bun team
Any Bun service, unchanged
Keploy runs the process you already run with bun. Elysia, Hono and a bare Bun.serve handler all record identically.
- Bun 1.x
- Elysia, Hono, Bun.serve
- Node-compatible packages
- No bunfig changes
Why Bun integration tests slow teams down
The friction is rarely the assertions. It is everything around them — spinning up dependencies, keeping mocks honest, and repairing tests after every refactor.
Testing Bun: by hand, with bun test, or with Keploy
bun test describes the exchange by hand and still needs the dependency supplied. Keploy records both halves once and replays them with nothing running.
Select any row for the full comparison, with code.
What you write for Bun vs what Keploy records
All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.
bun:test mocks the module, so the Postgres driver never runs.
A stub upstream on a real port, and a real database to seed.
Recorded from one real request. Nothing here was typed by hand.
Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.
Bun testing tools, compared
The options a team on Node.js actually reaches for, and where each one genuinely wins. Select a row for the full comparison.
Assessments reflect each tool’s documented behaviour, not benchmark measurements.
Record your Bun app once, replay it forever
Keploy sits below your Bun process at the network layer. It watches the calls your app already makes, then serves them back on replay so tests run with no dependencies attached.
Keploy records a GET call to /api/v1/orders/{id} on a Bun service and captures the dependency calls it makes.
What Keploy mocks for Bun, with zero config
5 of the 6 dependencies a typical Bun service talks to are stubbed from the recording itself — no mock classes, no fixture files, no containers in CI.
- Auto-mocked
PostgreSQLView page
Postgres protocol beneath Bun.sql and pg
- Auto-mocked
MySQLView page
MySQL protocol beneath mysql2
- Partial
SQLiteView page
Queries through bun:sqlite
- Auto-mocked
RedisView page
RESP beneath ioredis
- Auto-mocked
MongoDBView page
Wire protocol beneath the Mongo driver
- Outbound HTTPAuto-mocked
Outbound HTTP
Every fetch call
Your first Bun test suite in under five minutes
Every command below runs against your existing Bun service. Nothing in your source tree changes.
1Install the Keploy CLI
A single binary. It needs a Linux kernel with eBPF support, or Docker on macOS and Windows — and it adds nothing to your project's dependencies.
curl -sSL https://keploy.io/install.sh | bash2Record your service
Pass the command you already use to start the app. Keploy runs it and watches every socket it opens.
keploy record -c "bun run index.ts"3Exercise the paths you care about
Use curl, your frontend, or an existing smoke script. Every request becomes a test case with its Bun calls captured alongside it.
curl -X POST localhost:3000/orders/o-1/confirmcurl localhost:3000/orders/o-14Replay in CI
Replay serves the recorded dependency responses, so the job needs no service containers and no Docker daemon.
keploy test -c "bun run index.ts" --delay 10
Ready to try it on your own Bun service?
Works with the rest of your Bun stack
Keploy records at the network layer, so framework and driver choices inside your Bun app do not change how it captures traffic.
Node.js
Most Bun services are Node-compatible
Hono
Runs on Bun and records the same way
Elysia
Bun-native routing, captured at the socket
bun test
Keep it for unit tests
TypeScript
First class in Bun, irrelevant to capture
Deno
The same model on another modern runtime
Testing the rest of your stack
- Languages
Keploy as a Node.js testing framework
Replace nock registrations and in-memory database fixtures with tests recorded from the traffic your Node service already serves.
Read the guide - Languages
Keploy as a Deno testing framework
Record a running Deno service once and get integration coverage without replacing globalThis.fetch.
Read the guide - Frameworks
Keploy as a Hono testing framework
Record a running Hono service once and get integration coverage without stubbing every binding and fetch.
Read the guide - Languages
Keploy as a TypeScript testing framework
Get integration coverage for a TypeScript service without typed mock factories, casts, or a ts-jest transform.
Read the guide - Databases
Keploy as a PostgreSQL testing framework
Record the Postgres frontend/backend protocol once and replay real result sets in tests — no container, no pg-mem, no schema to rebuild.
Read the guide - Caches & Stores
Keploy as a Redis testing framework
Record RESP traffic once and replay real cache hits, misses, TTLs, and pipeline responses without a Redis server in CI.
Read the guide
Join our GlobalCommunity
Connect with developers worldwide. Follow updates, ask questions, share feedback, and ship faster with other Keploy builders.
“Best report of integration and API tests I've seen — which we don't get from RestAssured.”
G2“Future of microservices testing. I don't write tests now!”
G2 · 5/5“An amazing product that simplifies the automation.”
Gartner · 4.0