Skip to main content
Bun includes a fast, Jest-compatible test runner.

Run All Tests

bun test

Run Specific File

bun test math.test.ts

Watch Mode

bun test --watch

Example Test

math.test.ts
import { test, expect } from "bun:test";

test("addition", () => {
  expect(2 + 2).toBe(4);
});

test("async test", async () => {
  const result = await fetchData();
  expect(result).toBeDefined();
});
See Test Runner for complete documentation.

Build docs developers (and LLMs) love