A practical reference for Bun's built-in test runner that covers the everyday stuff you'll actually use. You get the core syntax for describe/it blocks, common matchers like toBe and toEqual, test modifiers like skip and only, and parameterized tests with test.each. The CLI options section is helpful for setting timeouts and running tests concurrently. It's Jest-compatible, so if you know Jest the transition is smooth. The matcher examples are comprehensive enough that you won't need to context switch to docs for basic assertions. Load this when you're writing tests in Bun and need a quick syntax check or want to remember how test.each works with objects.

skills.sh installs
375
GitHub stars
248
last updated
Aug 21, 2026

Install

$ npx -y skills add secondsky/claude-skills --skill bun-test-basics --agent claude-code

Installs into .claude/skills of the current project.

Files

Bun Test Basics

Bun ships with a fast, built-in, Jest-compatible test runner. Tests run with the Bun runtime and support TypeScript/JSX natively.

Quick Start

# Run all tests
bun test

# Run specific file
bun test ./test/math.test.ts

# Run tests matching pattern
bun test --test-name-pattern "addition"

Writing Tests

import { test, expect, describe } from "bun:test";

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

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

  test("subtraction", () => {
    expect(5 - 3).toBe(2);
  });
});

Test File Patterns

Bun discovers test files matching:

  • *.test.{js|jsx|ts|tsx}
  • *_test.{js|jsx|ts|tsx}
  • *.spec.{js|jsx|ts|tsx}
  • *_spec.{js|jsx|ts|tsx}

Test Modifiers

// Skip a test
test.skip("not ready", () => {
  // won't run
});

// Only run this test
test.only("focus on this", () => {
  // other tests won't run
});
// NOTE: in Bun 1.3+ `bun test` exits non-zero in CI when a file uses
// `test.only`. Use it for local debugging only — never commit it.

// Placeholder for future test
test.todo("implement later");

Sponsors

Details

Repository
github.com/secondsky/claude-skills
Category
Testing & QA
First seen
Jun 3, 2026

More from secondsky/claude-skills

All 146
1davila7 avatartest-driven-developmentdavila7/claude-code-templatesUse when implementing any feature or bugfix, before writing implementation code363skills.sh installs
2davila7 avatarab-test-setupdavila7/claude-code-templatesWhen the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this 356skills.sh installs
3pluginagentmarketplace avatarjava-testing-advancedpluginagentmarketplace/custom-plugin-javaAdvanced testing - Testcontainers, contract testing, mutation testing, property-based331skills.sh installs
4microsoft avatarplaywright-mcp-devmicrosoft/playwrightExplains how to add and debug playwright MCP tools and CLI commands.313skills.sh installs
5cinience avataralicloud-ai-multimodal-qwen-vl-testcinience/alicloud-skillsMinimal image-understanding smoke test for Model Studio Qwen VL.301skills.sh installs
6cinience avataralicloud-ai-video-wan-r2v-testcinience/alicloud-skillsMinimal reference-to-video smoke test for Model Studio Wan R2V.299skills.sh installs