Because Elysia implements the WinterTC (Web Interoperability) standard, you can test routes by passing standardDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/elysiajs/documentation/llms.txt
Use this file to discover all available pages before exploring further.
Request objects directly to app.handle() without binding to a port. Bun ships with a built-in Jest-compatible test runner that makes this straightforward.
Basic test with Bun Test
Createtest/index.test.ts and use bun:test to drive assertions:
End-to-end tests with Eden Treaty
Eden Treaty provides a type-safe client that mirrors your Elysia router’s shape. Using it in tests gives you auto-complete on paths and fully typed response bodies without starting a real HTTP server.Create a treaty client from your app instance
Pass the Elysia instance directly to
treaty(). No URL or port is needed.Using other test runners
app.handle() accepts any standard Request and returns a standard Response, so you can use Jest or Vitest in place of Bun’s test runner if your project requires it. The same request/response pattern applies regardless of the runner.