Agent skill

Bun Jest Migration

by secondsky in secondsky/claude-skills

A skill your agent uses when migrating from Jest to Bun's test runner, import compatibility, mocks, and config.

MITAuto-check passedTesting & QA

Install Bun Jest Migration

skills CLI
$ npx skills add secondsky/claude-skills --skill bun-jest-migration -a claude-code

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

GitHub CLI
$ gh skill install secondsky/claude-skills bun-jest-migration --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/secondsky/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/bun/skills/bun-jest-migration .claude/skills/bun-jest-migration && 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-jest-migration
GitHub stars
227
Token cost
~1.4k tokens
SKILL.md length
197 words
Files
1
Skills in repo
169
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when migrating from Jest to Bun's test runner, import compatibility, mocks, and config.

  • Works in 5 steps: Remove Jest packages → Update package.json → Convert jest.config.js to bunfig.toml → …
  • Migrating from Jest to Buns test runner
  • SKILL.md covers Quick Migration, Import Changes, API Compatibility and Mock Migration, plus 7 more sections
  • Calls bun and jest

What it does

Bun Jest Migration is an agent skill from secondsky/claude-skills. Use when migrating from Jest to Bun's test runner, import compatibility, mocks, and config.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Unit testing. It works with Jest. The repository describes itself as: Production-ready skills for Claude Code CLI - Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • Migrating from Jest to Buns test runner
  • Import compatibility

Example prompts

  • “/bun-jest-migration”

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Remove Jest packages
  2. Update package.json
  3. Convert jest.config.js to bunfig.toml
  4. Update imports in test files
  5. Run and fix

What it can do on your machine

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

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • bun
    • jest

    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.

Context cost

Bun Jest Migration loads about 1.4k tokens when it runs. Until then it costs about 28 tokens; SKILL.md has 197 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~28
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

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 passed

The automated check found no risky patterns in SKILL.md.

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 secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 197 words, ~1,406 tokens.

Download SKILL.mdSave it as .claude/skills/bun-jest-migration/SKILL.md (or your agent's skills folder).
name
bun-jest-migration
description
Use when migrating from Jest to Bun's test runner, import compatibility, mocks, and config.
metadata.version
1.0.0
license
MIT

Bun Jest Migration

Bun's test runner is Jest-compatible. Most Jest tests run without changes.

Quick Migration

bash
# 1. Remove Jest dependencies
bun remove jest ts-jest @types/jest babel-jest

# 2. Update test script
# package.json: "test": "bun test"

# 3. Run tests
bun test

Import Changes

typescript
// Before (Jest)
import { describe, it, expect, jest } from '@jest/globals';

// After (Bun) - No import needed, or explicit:
import { describe, test, expect, mock, spyOn } from "bun:test";

API Compatibility

Fully Compatible
JestBunNotes
describe()describe()Identical
it() / test()test()Use test()
expect()expect()Same matchers
beforeAll/EachbeforeAll/EachIdentical
afterAll/EachafterAll/EachIdentical
jest.fn()mock()Use mock()
jest.spyOn()spyOn()Identical
Requires Changes
JestBun Equivalent
jest.mock('module')mock.module('module', () => {...})
jest.useFakeTimers()import { setSystemTime } from "bun:test"
jest.setTimeout()Third argument to test()
jest.clearAllMocks()Call .mockClear() on each mock

Mock Migration

Mock Functions
typescript
// Jest
const fn = jest.fn().mockReturnValue('value');

// Bun
const fn = mock(() => 'value');
// Or for compatibility:
import { jest } from "bun:test";
const fn = jest.fn(() => 'value');
Module Mocking
typescript
// Jest (top-level hoisting)
jest.mock('./utils', () => ({
  helper: jest.fn(() => 'mocked')
}));

// Bun (inline, no hoisting)
import { mock } from "bun:test";
mock.module('./utils', () => ({
  helper: mock(() => 'mocked')
}));
Spy Migration
typescript
// Jest
jest.spyOn(console, 'log').mockImplementation(() => {});

// Bun (identical)
spyOn(console, 'log').mockImplementation(() => {});

Timer Migration

typescript
// Jest
jest.useFakeTimers();
jest.setSystemTime(new Date('2024-01-01'));
jest.advanceTimersByTime(1000);

// Bun - supports Jest-compatible timer APIs
import { setSystemTime } from "bun:test";
import { jest } from "bun:test";

jest.useFakeTimers();
jest.setSystemTime(new Date('2024-01-01'));
jest.advanceTimersByTime(1000);  // Now supported

Snapshot Testing

typescript
// Jest
expect(component).toMatchSnapshot();
expect(data).toMatchInlineSnapshot(`"expected"`);

// Bun (identical)
expect(component).toMatchSnapshot();
expect(data).toMatchInlineSnapshot(`"expected"`);

Update snapshots:

bash
bun test --update-snapshots

Configuration Migration

jest.config.js → bunfig.toml
javascript
// jest.config.js (before)
module.exports = {
  testMatch: ['**/*.test.ts'],
  testTimeout: 10000,
  setupFilesAfterEnv: ['./jest.setup.ts'],
  collectCoverage: true,
  coverageThreshold: { global: { lines: 80 } }
};
toml
# bunfig.toml (after)
[test]
root = "./"
preload = ["./jest.setup.ts"]
timeout = 10000
coverage = true
coverageThreshold = 0.8

Common Migration Issues

Issue: jest.mock Not Working
typescript
// Jest mock hoisting doesn't exist in Bun
// Move mock.module before imports or use dynamic imports

// Solution 1: Use mock.module at top
mock.module('./api', () => ({ fetch: mock() }));
import { fetch } from './api';

// Solution 2: Dynamic import
const mockFetch = mock();
mock.module('./api', () => ({ fetch: mockFetch }));
const { fetch } = await import('./api');
Issue: Timer Functions Missing
typescript
// Bun timer support is limited
// Use setSystemTime for date mocking
import { setSystemTime } from "bun:test";

beforeEach(() => {
  setSystemTime(new Date('2024-01-01'));
});

afterEach(() => {
  setSystemTime(); // Reset to real time
});
Issue: Custom Matchers
typescript
// Jest
expect.extend({ toBeWithinRange(received, floor, ceiling) {...} });

// Bun (same API)
import { expect } from "bun:test";
expect.extend({
  toBeWithinRange(received, floor, ceiling) {
    const pass = received >= floor && received <= ceiling;
    return {
      pass,
      message: () => `expected ${received} to be within ${floor}-${ceiling}`
    };
  }
});

Step-by-Step Migration

  1. Remove Jest packages

    bash
    bun remove jest ts-jest @types/jest babel-jest jest-environment-jsdom
  2. Update package.json

    json
    {
      "scripts": {
        "test": "bun test",
        "test:watch": "bun test --watch",
        "test:coverage": "bun test --coverage"
      }
    }
  3. Convert jest.config.js to bunfig.toml

  4. Update imports in test files

    • Find/replace @jest/globals → bun:test
    • Find/replace jest.fn() → mock()
    • Find/replace jest.mock() → mock.module()
  5. Run and fix

    bash
    bun test 2>&1 | head -50  # Check first errors

Common Errors

ErrorCauseFix
Cannot find module '@jest/globals'Old importUse bun:test
jest is not definedGlobal jestImport from bun:test
mock.module is not a functionWrong importimport { mock } from "bun:test"
Snapshot mismatchDifferent serializationUpdate with --update-snapshots

When to Load References

Load references/compatibility-matrix.md when:

  • Full Jest API compatibility details
  • Unsupported features list
  • Workarounds for missing features

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

Files

Just SKILL.md in plugins/bun/skills/bun-jest-migration of secondsky/claude-skills.

Open the folder on GitHubat commit 8837836

Compare with similar skills

Bun Jest Migration 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 Jest Migration compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bun Jest Migration this skillsecondsky/claude-skills227—~1.4kAutomated safety check: PassMIT
Jest Testing PatternsChrisWiles/claude-code-showcase6.1k7 repos~1.5kAutomated safety check: PassNone
Vitestsupabase/supabase111k12 repos~1.1kAutomated safety check: PassApache-2.0
Test GuardamElnagdy/guard-skills1.3k2 repos~2.1kAutomated safety check: PassMIT
Vitestpixel-point/animate-text1492 repos~1.3kAutomated safety check: PassNone
Test Guidelinesgetsentry/sentry-react-native1.8k—~1.3kAutomated safety check: PassMIT

Similar skills

  • Jest Testing Patterns

    ChrisWiles/claude-code-showcase

    Jest patterns for React Native style tests: TDD discipline, mock factory functions, module and GraphQL hook mocking, custom render helpers and anti-patterns to avoid.

    6.1k GitHub starsUsed in 7 repos~1.5k tokens
    Testing & QAAuto-check passed
  • Vitest

    supabase/supabase

    Official

    Vitest API and config reference (Jest-compatible) — mocking with vi., spies, fake timers, coverage configuration, fixtures, snapshots, and test filtering.

    111k GitHub starsUsed in 12 repos~1.1k tokens
    Testing & QAAuto-check passed
  • Test Guard

    amElnagdy/guard-skills

    Reviews newly written or edited tests against nine rules that cut test bloat, such as mock-heavy checks and near-duplicate cases, before they are committed.

    1.3k GitHub starsUsed in 2 repos~2.1k tokens
    Testing & QAAuto-check passed
  • Vitest

    pixel-point/animate-text

    Vitest testing framework patterns for test setup, async testing, mocking with vi., snapshots, and test performance (formerly test-vitest).

    149 GitHub starsUsed in 2 repos~1.3k tokens
    Testing & QAAuto-check passed
  • Test Guidelines

    getsentry/sentry-react-native

    Official

    Enforce Sentry React Native SDK test conventions for naming, structure, mocking, and fixtures with Jest.

    1.8k GitHub stars~1.3k tokensUpdated today
    Testing & QAAuto-check passed
  • Designing Tests

    CloudAI-X/claude-workflow-v2

    Designs and implements testing strategies for any codebase. An agent skill from CloudAI-X/claude-workflow-v2.

    1.4k GitHub starsUsed in 1 repo~1.5k tokens
    Testing & QAAuto-check passed

More from secondsky/claude-skills

All 169 skills in this repo
  • Tanstack AI

    secondsky/claude-skills

    TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.

    227 GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check: notes
  • Auto Animate

    secondsky/claude-skills

    AutoAnimate (@formkit/auto-animate) zero-config animations for React.

    227 GitHub stars~2.9k tokensUpdated 10 days ago
    Auto-check passed
  • Base UI React

    secondsky/claude-skills

    MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.9k tokensUpdated 10 days ago
    Auto-check passed
  • Cloudflare Images

    secondsky/claude-skills

    This skill should be used when the user asks to "upload images to Cloudflare", "implement direct creator upload", "configure image transformations", "optimize WebP/AVIF", "create image variants"…

    227 GitHub stars~3.6k tokensUpdated 10 days ago
    Auto-check: notes
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 10 days ago
    Auto-check: notes
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 10 days ago
    Auto-check passed

Works with

Categories

Questions about Bun Jest Migration

What does Bun Jest Migration do?

A skill your agent uses when migrating from Jest to Bun's test runner, import compatibility, mocks, and config. Bun Jest Migration is an agent skill from secondsky/claude-skills. Use when migrating from Jest to Bun's test runner, import compatibility, mocks, and config.

When should I use Bun Jest Migration?

Bun Jest Migration fits situations like: migrating from Jest to Buns test runner; import compatibility.

How do I install Bun Jest Migration in Claude Code?

Run `npx skills add secondsky/claude-skills --skill bun-jest-migration -a claude-code`. Or copy the skill folder (plugins/bun/skills/bun-jest-migration in secondsky/claude-skills) into .claude/skills/bun-jest-migration in your project. Claude Code loads it when a task matches its description.

How do I install Bun Jest Migration in Codex?

Run `npx skills add secondsky/claude-skills --skill bun-jest-migration -a codex`. Or copy the skill folder (plugins/bun/skills/bun-jest-migration in secondsky/claude-skills) into .agents/skills/bun-jest-migration in your project. Codex loads it when a task matches its description.

Can I use Bun Jest Migration 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 secondsky/claude-skills --skill bun-jest-migration -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-jest-migration, .gemini/skills/bun-jest-migration, .github/skills/bun-jest-migration and .opencode/skills/bun-jest-migration in your project.

What does Bun Jest Migration need to run?

Going by SKILL.md and its folder, Bun Jest Migration needs the command-line tools its instructions call (bun and jest).

Does Bun Jest Migration 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 Jest Migration safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Bun Jest Migration use?

Bun Jest Migration is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bun Jest Migration use?

About 1.4k tokens (SKILL.md is roughly 5.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Bun Jest Migration?

Skills that share tags, products or a category with Bun Jest Migration: Jest Testing Patterns (ChrisWiles/claude-code-showcase, 6.1k stars), Vitest (supabase/supabase, 111k stars), Test Guard (amElnagdy/guard-skills, 1.3k stars) and Vitest (pixel-point/animate-text, 149 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bun Jest Migration?

secondsky (a GitHub user) maintains it in secondsky/claude-skills, which has 227 GitHub stars. The repository holds 169 skills in this directory. The repository was last updated on September 28, 2026.

Source: secondsky/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.