bun-test

Configure Bun's test runner with Jest-compatible APIs and mocking primitives.

6|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/memoirlabs/mog --skill bun-test-memoirlabs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bun-test
Source: https://github.com/memoirlabs/mog/tree/main/.agents/skills/bun-test
Command: npx skills add https://github.com/memoirlabs/mog --skill bun-test-memoirlabs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

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.

Frequently Asked Questions about bun-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate Jest tests to Bun's built-in test runner?

Migrate Jest tests to Bun by leveraging Bun’s test runner with Jest-compatible APIs, allowing familiar describe/test/expect syntax and matchers to run natively while reducing test runtime and removing setup friction.

How do I configure test coverage and preload files in Bun?

Configure test coverage and preload files in Bun by creating a bunfig.toml file in your project root, defining the test section with specific preload settings, coverage thresholds, and timeouts to match your testing expectations.

Can I use Jest mocking and spying functions like mock() and spyOn() in Bun?

Yes, you can isolate boundaries and side effects in Bun tests using built-in mocking primitives like mock() and spyOn() provided by bun:test, ensuring deterministic unit and integration test execution without external dependencies.

What types of tests does the Bun test runner support?

The Bun test runner supports writing unit, integration, API, snapshot, and async tests using Jest-compatible APIs and bun:test matchers, accelerating reliable test execution without requiring external testing frameworks.

Do I need Jest installed to write Jest-compatible tests in Bun?

No, you do not need Jest installed to write Jest-compatible tests in Bun, because Bun provides a built-in test runner with familiar describe/test/expect primitives and matchers natively through the bun:test module.

What's the best way to speed up slow Jest test execution in TypeScript projects?

Speed up slow Jest execution in TypeScript projects by migrating to Bun’s built-in test runner, which removes setup time and accelerates reliable test execution while maintaining Jest-compatible APIs for existing tests.