Agent skill

Bun Test

by involvex in involvex/youtube-music-cli

Configure Bun's built-in test runner with Jest-compatible APIs.

MITAuto-check: notesTesting & QA

Install Bun Test

skills CLI
$ npx skills add involvex/youtube-music-cli --skill bun-test -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install involvex/youtube-music-cli bun-test --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/involvex/youtube-music-cli.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/bun-test .claude/skills/bun-test && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bun-test
GitHub stars
456
Token cost
~2.3k tokens
SKILL.md length
308 words
Files
4 (incl. references)
Skills in repo
6
Repo updated
First seen
Licence
MIT

At a glance

Configure Bun's built-in test runner with Jest-compatible APIs.

  • Works in 9 steps: Check Prerequisites → Determine Testing Needs → Create Test Directory Structure → …
  • Setting up testing infrastructure
  • SKILL.md covers Quick Reference, Core Workflow, Jest Migration and Common Test Patterns, plus 7 more sections
  • Calls bun

What it does

Bun Test is an agent skill from involvex/youtube-music-cli. Configure Bun's built-in test runner with Jest-compatible APIs. Use when setting up testing infrastructure, writing unit/integration/snapshot tests, migrating from Jest, or configuring test coverage. 3-10x faster than Jest.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/examples.md`, `references/jest-migration.md` and `references/mocking.md`). Compatibility notes: Requires Bun 1.0+

It sits in Testing & QA, covering Unit testing and Test coverage. It works with Jest and YouTube. The repository describes itself as: A powerful Terminal User Interface (TUI) music player for YouTube Music. The licence is MIT.

When your agent uses it

  • Setting up testing infrastructure
  • Writing unit/integration/snapshot tests
  • Migrating from Jest
  • Configuring test coverage

Example prompts

  • “/bun-test”

Requirements

  • Compatibility (from SKILL.md): Requires Bun 1.0+
  • Pre-approved tools (allowed-tools): Bash, Write, Read

Workflow steps

9 steps, taken from the step headings in SKILL.md.

  1. Check Prerequisites
  2. Determine Testing Needs
  3. Create Test Directory Structure
  4. Configure Bun Test
  5. Create Test Setup File
  6. Write First Test
  7. Add Mocking (If Needed)
  8. Update package.json
  9. Run Tests

What it can do on your machine

Read from SKILL.md and the folder at commit a0d4e49. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash
    • Write
    • Read

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • bun

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Requires Bun 1.0+

    From compatibility in the SKILL.md frontmatter.

Context cost

Bun Test loads about 2.3k tokens when it runs, and up to ~7.2k if it reads all its reference files. Until then it costs about 58 tokens; SKILL.md has 308 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~58
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~7.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Bash, Write, Read

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from involvex/youtube-music-cli at commit a0d4e49, republished under its MIT licence (© involvex). 308 words, ~2,265 tokens.

Download SKILL.mdSave it as .claude/skills/bun-test/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
bun-test
description
Configure Bun's built-in test runner with Jest-compatible APIs. Use when setting up testing infrastructure, writing unit/integration/snapshot tests, migrating from Jest, or configuring test coverage. 3-10x faster than Jest.
allowed-tools
Bash, Write, Read
compatibility
Requires Bun 1.0+
metadata.author
dale
metadata.category
bun-runtime
metadata.tags
bun, testing, jest, unit-tests, tdd

Bun Test Configuration

Set up Bun's built-in test runner with Jest-compatible APIs and significantly faster execution (3-10x faster than Jest).

Quick Reference

For detailed patterns, see:

  • Jest Migration: jest-migration.md - Complete Jest to Bun migration guide
  • Mocking: mocking.md - Mock functions, spies, module mocking
  • Examples: examples.md - Test patterns for APIs, databases, async code

Core Workflow

1. Check Prerequisites
bash
# Verify Bun installation
bun --version

# Check if project exists
ls -la package.json
2. Determine Testing Needs

Ask the user what type of testing they need:

  • Unit Testing: Test individual functions and modules
  • Integration Testing: Test component interactions
  • API Testing: Test HTTP endpoints
  • Snapshot Testing: Test output consistency
3. Create Test Directory Structure
bash
# Create test directories
mkdir -p tests/{unit,integration,fixtures}

Recommended structure:

project/
├── src/
│   ├── utils.ts
│   └── components/
├── tests/
│   ├── unit/              # Unit tests
│   ├── integration/       # Integration tests
│   ├── fixtures/          # Test data
│   └── setup.ts          # Global setup
├── package.json
└── bunfig.toml           # Test configuration
4. Configure Bun Test

Create bunfig.toml in project root:

toml
[test]
# Preload files before running tests
preload = ["./tests/setup.ts"]

# Code coverage
coverage = true
coverageDir = "coverage"
coverageThreshold = 80

# Timeouts (in milliseconds)
timeout = 5000

# Bail after first failure
bail = false
5. Create Test Setup File

Create tests/setup.ts:

typescript
import { beforeAll, afterAll, beforeEach, afterEach } from "bun:test";

// Global test setup
beforeAll(() => {
  console.log("🧪 Starting test suite");
  process.env.NODE_ENV = "test";
});

afterAll(() => {
  console.log("✅ Test suite complete");
});

// Reset mocks before each test
beforeEach(() => {
  // Clear mock state
});

afterEach(() => {
  // Cleanup after each test
});

// Global test utilities
globalThis.testHelpers = {
  wait: (ms: number) => new Promise(resolve => setTimeout(resolve, ms)),
};
6. Write First Test

Create tests/unit/example.test.ts:

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

// Simple test
test("addition works", () => {
  expect(1 + 1).toBe(2);
});

// Describe blocks for organization
describe("Array utilities", () => {
  it("should filter even numbers", () => {
    const numbers = [1, 2, 3, 4, 5, 6];
    const evens = numbers.filter(n => n % 2 === 0);

    expect(evens).toEqual([2, 4, 6]);
    expect(evens).toHaveLength(3);
  });
});

// Async tests
describe("Async operations", () => {
  it("should handle promises", async () => {
    const result = await Promise.resolve(42);
    expect(result).toBe(42);
  });
});

For more test examples (API testing, database testing, etc.), see examples.md.

7. Add Mocking (If Needed)
typescript
import { describe, it, expect, mock, spyOn } from "bun:test";

describe("Mock functions", () => {
  it("should create mock functions", () => {
    const mockFn = mock((x: number) => x * 2);

    const result = mockFn(5);

    expect(result).toBe(10);
    expect(mockFn).toHaveBeenCalledTimes(1);
    expect(mockFn).toHaveBeenCalledWith(5);
  });

  it("should spy on methods", () => {
    const obj = {
      method: (x: number) => x * 2,
    };

    const spy = spyOn(obj, "method");

    obj.method(5);

    expect(spy).toHaveBeenCalledWith(5);
    expect(spy).toHaveReturnedWith(10);
  });
});

For advanced mocking patterns, see mocking.md.

8. Update package.json

Add test scripts:

json
{
  "scripts": {
    "test": "bun test",
    "test:watch": "bun test --watch",
    "test:coverage": "bun test --coverage",
    "test:ui": "bun test --coverage --reporter=html"
  }
}
9. Run Tests
bash
# Run all tests
bun test

# Run specific file
bun test tests/unit/utils.test.ts

# Watch mode
bun test --watch

# With coverage
bun test --coverage

# Filter by name
bun test --test-name-pattern="should handle"

Jest Migration

If migrating from Jest, see jest-migration.md for:

  • Import updates (@jest/globals → bun:test)
  • Mock syntax changes (jest.fn() → mock())
  • Configuration migration
  • Compatibility notes

Key changes:

typescript
// Before (Jest)
import { describe, it, expect } from '@jest/globals';
const mockFn = jest.fn();

// After (Bun)
import { describe, it, expect, mock } from 'bun:test';
const mockFn = mock();

Common Test Patterns

Testing Functions
typescript
import { test, expect } from "bun:test";

function add(a: number, b: number): number {
  return a + b;
}

test("add function", () => {
  expect(add(2, 3)).toBe(5);
  expect(add(-1, 1)).toBe(0);
});
Testing Errors
typescript
test("should throw errors", () => {
  const throwError = () => {
    throw new Error("Something went wrong");
  };

  expect(throwError).toThrow("Something went wrong");
  expect(throwError).toThrow(Error);
});

test("should reject promises", async () => {
  const asyncReject = async () => {
    throw new Error("Async error");
  };

  await expect(asyncReject()).rejects.toThrow("Async error");
});
Snapshot Testing
typescript
test("should match snapshot", () => {
  const data = {
    id: 1,
    name: "Test User",
    email: "test@example.com",
  };

  expect(data).toMatchSnapshot();
});

test("should match inline snapshot", () => {
  const config = { theme: "dark", language: "en" };

  expect(config).toMatchInlineSnapshot(`
    {
      "theme": "dark",
      "language": "en"
    }
  `);
});

Matchers Reference

Common matchers available:

typescript
// Equality
expect(value).toBe(expected);           // ===
expect(value).toEqual(expected);        // Deep equality

// Truthiness
expect(value).toBeTruthy();
expect(value).toBeFalsy();
expect(value).toBeDefined();
expect(value).toBeUndefined();

// Numbers
expect(number).toBeGreaterThan(3);
expect(number).toBeLessThan(5);

// Strings
expect(string).toMatch(/pattern/);
expect(string).toContain("substring");

// Arrays
expect(array).toContain(item);
expect(array).toHaveLength(3);

// Objects
expect(object).toHaveProperty("key");
expect(object).toMatchObject({ subset });

// Promises
await expect(promise).resolves.toBe(value);
await expect(promise).rejects.toThrow();

// Mock functions
expect(mockFn).toHaveBeenCalled();
expect(mockFn).toHaveBeenCalledTimes(3);
expect(mockFn).toHaveBeenCalledWith(arg1, arg2);

Test Organization

Setup and Teardown
typescript
import { beforeAll, afterAll, beforeEach, afterEach, describe, it } from "bun:test";

describe("User service", () => {
  let db: Database;

  beforeAll(async () => {
    // Setup before all tests
    db = await connectToDatabase();
  });

  afterAll(async () => {
    // Cleanup after all tests
    await db.close();
  });

  beforeEach(async () => {
    // Reset before each test
    await db.clear();
  });

  it("should create user", async () => {
    const user = await db.users.create({ name: "Test" });
    expect(user.id).toBeDefined();
  });
});

Coverage Configuration

View coverage report:

bash
# Generate coverage
bun test --coverage

# View HTML report
bun test --coverage --reporter=html
open coverage/index.html

Set coverage thresholds in bunfig.toml:

toml
[test]
coverage = true
coverageThreshold = 80  # Fail if coverage < 80%

Debugging Tests

bash
# Run with debugger
bun test --inspect

# Verbose output
bun test --verbose

# Show all test results
bun test --reporter=tap

Performance

Bun test is significantly faster than Jest:

  • Jest: ~15 seconds for 100 tests
  • Bun: ~2 seconds for 100 tests

3-10x faster execution!

Completion Checklist

  • ✅ Test directory structure created
  • ✅ bunfig.toml configured
  • ✅ Test setup file created
  • ✅ Example tests written
  • ✅ Package.json scripts updated
  • ✅ Tests run successfully
  • ✅ Coverage configured (if needed)

Next Steps

After basic setup:

  1. Write tests: Add tests for critical business logic
  2. CI/CD: Configure tests to run in your pipeline
  3. Coverage: Set up coverage reporting
  4. Pre-commit: Add pre-commit hooks to run tests
  5. Documentation: Document testing patterns for the team

For detailed implementations, see the reference files linked above.

© involvex, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in .agents/skills/bun-test of involvex/youtube-music-cli.

  • SKILL.md
  • references/examples.md
  • references/jest-migration.md
  • references/mocking.md

Open the folder on GitHubat commit a0d4e49

Compare with similar skills

Bun Test next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Bun Test compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bun Test this skillinvolvex/youtube-music-cli456—~2.3kAutomated safety check: NotesMIT
Write Testsgrafana/synthetic-monitoring-app171—~1.2kAutomated safety check: PassAGPL-3.0
Write Testsopenplayerjs/openplayerjs649—~1.8kAutomated safety check: PassMIT
Test Specialisttravisjneuman/.claude101—~3.7kAutomated safety check: PassMIT
Senior QAalirezarezvani/claude-skills28k1 repos~2.1kAutomated safety check: PassMIT
TDD Guidealirezarezvani/claude-skills28k—~3.4kAutomated safety check: PassMIT

Similar skills

  • Write Tests

    grafana/synthetic-monitoring-app

    Official

    Write Jest integration and unit tests for the Grafana Synthetic Monitoring app using React Testing Library, MSW, and src/test helpers.

    171 GitHub stars~1.2k tokensUpdated today
    Testing & QAAuto-check passed
  • Write Tests

    openplayerjs/openplayerjs

    Write or extend Jest tests for OpenPlayerJS to this repo's exact conventions — makeCore factories, typed internals handles instead of as any, media property mocking, fake timers, ads/vast mocks, and…

    649 GitHub stars~1.8k tokensUpdated 2 days ago
    Testing & QAAuto-check passed
  • Test Specialist

    travisjneuman/.claude

    Test-writing patterns for JS/TS, Python, Go, and Rust (unit, integration, E2E, visual regression).

    101 GitHub stars~3.7k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Senior QA

    alirezarezvani/claude-skills

    Generates unit tests, integration tests, and E2E tests for React/Next.js applications.

    28k GitHub starsUsed in 1 repo~2.1k tokens
    Testing & QAAuto-check passed
  • TDD Guide

    alirezarezvani/claude-skills

    Test-driven development skill for writing unit tests, generating test fixtures and mocks, analyzing coverage gaps, and guiding red-green-refactor workflows across Jest, Pytest, JUnit, Vitest, and…

    28k GitHub stars~3.4k tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Sf Testing

    Jaganpro/sf-skills

    Apex test execution, coverage analysis, and test-fix loops with 120-point scoring.

    424 GitHub stars~1.1k tokensUpdated 5 mo ago
    Testing & QAAuto-check passed

More from involvex/youtube-music-cli

  • React State Management

    involvex/youtube-music-cli

    Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query.

    456 GitHub starsUsed in 12 repos~3k tokens
    Auto-check passed
  • Bun Win32

    involvex/youtube-music-cli

    Win32 FFI binding lifecycle for @bun-win32/ packages (Win32 DLL bindings via bun:ffi on Windows).

    456 GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Bun Build

    involvex/youtube-music-cli

    Create optimized production bundles with Bun's native bundler.

    456 GitHub stars~2.1k tokensUpdated yesterday
    Auto-check: notes
  • Bun Dev Server

    involvex/youtube-music-cli

    Set up high-performance development servers with Hot Module Replacement.

    456 GitHub stars~2.9k tokensUpdated yesterday
    Auto-check: notes
  • Bun Init

    involvex/youtube-music-cli

    Initialize a new Bun project with TypeScript and optimal configuration.

    456 GitHub stars~2.1k tokensUpdated yesterday
    Auto-check: notes

Works with

Categories

Questions about Bun Test

What does Bun Test do?

Configure Bun's built-in test runner with Jest-compatible APIs. Bun Test is an agent skill from involvex/youtube-music-cli. Configure Bun's built-in test runner with Jest-compatible APIs.

When should I use Bun Test?

Bun Test fits situations like: setting up testing infrastructure; writing unit/integration/snapshot tests; migrating from Jest; configuring test coverage.

How do I install Bun Test in Claude Code?

Run `npx skills add involvex/youtube-music-cli --skill bun-test -a claude-code`. Or copy the skill folder (.agents/skills/bun-test in involvex/youtube-music-cli) into .claude/skills/bun-test in your project. Claude Code loads it when a task matches its description.

How do I install Bun Test in Codex?

Run `npx skills add involvex/youtube-music-cli --skill bun-test -a codex`. Or copy the skill folder (.agents/skills/bun-test in involvex/youtube-music-cli) into .agents/skills/bun-test in your project. Codex loads it when a task matches its description.

Can I use Bun Test in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add involvex/youtube-music-cli --skill bun-test -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bun-test, .gemini/skills/bun-test, .github/skills/bun-test and .opencode/skills/bun-test in your project.

What does Bun Test need to run?

Going by SKILL.md and its folder, Bun Test needs the command-line tools its instructions call (bun). Its frontmatter pre-approves these tools: Bash, Write, Read. Compatibility (from SKILL.md): Requires Bun 1.0+.

Does Bun Test access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Bun Test safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Bun Test use?

Bun Test is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bun Test use?

About 2.3k tokens (SKILL.md is roughly 9.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 4.9k tokens, read only when the agent opens those files.

What are the alternatives to Bun Test?

Skills that share tags, products or a category with Bun Test: Write Tests (grafana/synthetic-monitoring-app, 171 stars), Write Tests (openplayerjs/openplayerjs, 649 stars), Test Specialist (travisjneuman/.claude, 101 stars) and Senior QA (alirezarezvani/claude-skills, 28k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bun Test?

involvex (a GitHub user) maintains it in involvex/youtube-music-cli, which has 456 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on October 6, 2026.

Source: involvex/youtube-music-cli on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.