Skip to content
secondsky avatar

Bun Jest Migration

Step-by-step guide that moves a Jest test suite to Bun's runner, covering imports, mocks, timers, and config.

CCM score
54 of 100
skills.sh installs
408
GitHub stars
257
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers removing Jest packages, switching the test script to bun test, and converting jest.config.js to bunfig.toml
  • Includes a Jest-to-Bun API table marking which calls are identical, which need renaming, and which need rewriting
  • Maps jest.mock hoisting to mock.module with dynamic-import workarounds, plus fake-timer replacements built on setSystemTime
  • Designed for teams with an existing Jest suite who want to move to Bun without rewriting every test

Install

$ npx -y skills add secondsky/claude-skills --skill bun-jest-migration -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Bun Jest Migration

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

Quick Migration

# 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

// 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

Details

Repository
github.com/secondsky/claude-skills
Categories
Testing & QA, Frontend & UI Code
First seen
Jun 3, 2026

Questions

What does the bun-jest-migration skill do?

It guides migration of a project from Jest to Bun's test runner, covering import changes, mock conversion, timer and snapshot handling, and config translation from jest.config.js to bunfig.toml. Most Jest tests run without changes once the imports are updated.

How do I install the bun-jest-migration skill?

Run npx -y skills add secondsky/claude-skills --skill bun-jest-migration -y in a project. After installing, the agent can walk you through removing Jest packages and switching the test script to bun test.

Which other skills sit in the Testing and QA category?

This skill is in the Testing and QA category alongside tdd, migrate-to-shoehorn, test-driven-development, webapp-testing and break-ui. It stands apart by focusing on moving an existing Jest suite over to Bun rather than writing new tests.

Do I need Jest installed to use bun-jest-migration?

No Jest installation is needed to follow the migration steps, since the skill tells you which Jest packages to remove with bun remove. It works on a project that currently uses Jest and @types/jest with ts-jest or babel-jest.

More from secondsky/claude-skills

All 116

Similar to Bun Jest Migration

More Testing & QA