Agent skill · software engineering · secondsky

bun-jest-migration

Use when migrating from Jest to Bun's test runner, import compatibility, mocks, and config.

Why this skill is useful

Provides specific migration commands and patterns for transitioning from Jest to Bun, which the AI wouldn't reliably generate on its own.

What it needs

Requires bun installed locally. About 3k tokens when loaded. Last updated 2026-08-06. 204 stars on the source repository.

What this skill does

Bun Jest Migration Bun's test runner is Jest-compatible. Most Jest tests run without changes. Quick Migration Import Changes API Compatibility Fully Compatible Jest Bun Notes ------ ----- ------- describe() describe() Identical it() / test() test() Use test() expect() expect() Same matchers beforeAll/Each beforeAll/Each Identical afterAll/Each afterAll/Each Identical jest.fn() mock() Use mock() jest.spyOn() spyOn() Identical Requires Changes Jest Bun 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 Module Mocking Spy Migration Timer Migration Snapshot Testing Update snapshots: Configuration Migration jest.config.js → bunfig.toml Common Migration Issues Issue: jest.mock Not Working Issue: Timer Functions Missing Issue: Custom Matchers Step-by-Step Migration 1. Remove Jest packages 2. Update package.json 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 Common Errors Error Cause Fix ------- ------- ----- Cannot find module '@jest/globals' Old import Use bun:test jest is not defined Global jest Import from bun:test mock.module is not a function Wrong import import { mock } from "bun:test" Snapshot mismatch Different serialization Update 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

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills secondsky/bun-jest-migration

View the source on GitHub

Browse the @skills marketplace