What problem does it solve?
It solves the friction of configuring and migrating test infrastructure by showing how to use Bun’s built-in test runner with Jest-compatible APIs so you can write and run reliable unit, integration, and snapshot tests quickly.
Core Features & Use Cases
- Configure Bun test (bunfig.toml): Set preload files, coverage, thresholds, and timeouts to match your team’s testing expectations.
- Write Jest-like tests using bun:test: Use familiar testing primitives like describe/test/expect plus common matchers for assertions.
- Use mocking and spying for isolation: Mock functions and spy on object methods to test boundaries and side effects deterministically.
Use case example: You’re migrating a TypeScript project from Jest to Bun and need equivalent unit tests, coverage gating, and mocks/spies to keep CI stable while reducing test runtime.
Quick Start
Configure Bun’s test runner by creating a bunfig.toml in your project root with coverage and a test preload file, then run bun test to validate your setup.