module

bun:test

The 'bun:test' module is a fast, built-in test runner that aims for Jest compatibility. Tests are executed with the Bun runtime, providing significantly improved performance over traditional test runners.

Key features include TypeScript and JSX support, lifecycle hooks (beforeAll, beforeEach, afterEach, afterAll), snapshot testing, UI & DOM testing, watch mode, and script pre-loading. The API supports test assertions with expect, test grouping with describe, mocks, and more.

While Bun aims for compatibility with Jest, not everything is implemented yet. Use bun test to automatically discover and run tests matching common patterns like *.test.ts or *.spec.js.

Functions 8

Interfaces 10

Types 7

Variables 8

Namespaces 1