
Bun Test Basics
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-codeInstalls 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- Woocommerce Copy Guidelines374
- Woocommerce Dev Cycle374
- Cloudflare Workers Security369
- Bun Nextjs358
- Bun Package Manager358
- Bun Drizzle Integration353
- Bun Docker343
- Bun Runtime342
- Cloudflare Workers Testing340
- Bun Cloudflare Workers338
- Bun Test Coverage337
- Bun Http Server336
- Bun Test Mocking335
- Nuxt Seo335
- Bun Bundler334
- Bun Workers333
- Bun Shell331
- Bun React Ssr330
- Bun Tanstack Start329
- Cloudflare Workers Performance329
- Bun Hot Reloading328
- Bun Redis328
- Bun Ffi326
- Bun Jest Migration326