bun-test-basics

Solid

Use for bun:test syntax, assertions, describe/it, test.skip/only/each, and basic patterns.

Testing & QA 162 stars 25 forks Updated 2 weeks ago MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
74
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# 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 ```bash # 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 ```typescript 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 ```typescript // Skip a test test.skip("not ready", () => { // won't run }); // Only run this test test.only("focus on this", () => { // other tests won't run }); // Placeholder for future test test.todo("implement later"); // Expected to fail test.failing("known bug", () => { throw new Error("This is expected"); }); ``` ## Parameterized Tests ```typescript test.each([ [1, 1, 2], [2, 2, 4], [3, 3, 6], ])("add(%i, %i) = %i", (a, b, expected) => { expect(a + b).toBe(expected); }); // With objects test.each([ { a: 1, b: 2, expected: 3 }, { a: 5, b: 5, expected: 10 }, ])("add($a, $b) = $expected", ({ a, b, expected }) => { expect(a + b).toBe(expected); }); ``` ## C...

Details

Author
secondsky
Repository
secondsky/claude-skills
Created
6 months ago
Last Updated
2 weeks ago
Language
TypeScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category