secondsky avatar

Bun Jest Migration

Migrating from Jest to Bun's test runner is mostly painless since Bun maintains Jest compatibility, but there are a few gotchas around module mocking and timers. This guide walks you through removing Jest dependencies, updating imports from @jest/globals to bun:test, and translating the parts that differ (like jest.mock becoming mock.module and jest.fn becoming mock). The configuration section showing jest.config.js to bunfig.toml conversion is helpful, and the troubleshooting table catches the main pain points like mock hoisting not working the same way. If you're moving a test suite to Bun, this covers the practical stuff you'll actually hit.

skills.sh installs
326
GitHub stars
248
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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

Sponsors

Details

Repository
github.com/secondsky/claude-skills
Category
Testing & QA
First seen
Jun 3, 2026

More from secondsky/claude-skills

All 146
1davila7 avatartdd-workflowdavila7/claude-code-templatesTest-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.290skills.sh installs
2dhruvanbhalara avatarflutter-testingdhruvanbhalara/skillsDefine testing strategy, test pyramid, and pattern-based conventions (Golden Variants, State Matrix, Interaction Contracts). Use when establishing test architec283skills.sh installs
3dubzzz avatarjavascript-testing-expertdubzzz/fast-checkExpert-level JavaScript testing skill focused on writing high-quality tests that find bugs, serve as documentation, and prevent regressions. Advocates for prope269skills.sh installs
4patricio0312rev avatarintegration-test-builderpatricio0312rev/skillsCreates integration tests for API endpoints with database flows, including test harness setup, fixtures, setup/teardown, database seeding, and CI-friendly strat263skills.sh installs
5patricio0312rev avatarcoverage-strategistpatricio0312rev/skillsDefines ROI-based coverage targets with critical path identification, layer-specific targets, and explicit "don't test this" guidelines. Use for "test coverage"259skills.sh installs
6aiskillstore avatarwebapp-testingaiskillstore/marketplaceToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing br235skills.sh installs