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.
A skill your agent uses when migrating from Jest to Bun's test runner, import compatibility, mocks, and config.
$ npx skills add secondsky/claude-skills --skill bun-jest-migration -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install secondsky/claude-skills bun-jest-migration --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ 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-srcUse ~/.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/
Install the "bun-jest-migration" agent skill from https://github.com/secondsky/claude-skills/tree/main/plugins/bun/skills/bun-jest-migration into .claude/skills/bun-jest-migration/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bun-jest-migration", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/secondsky/claude-skills/tree/main/plugins/bun/skills/bun-jest-migrationType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add secondsky/claude-skills --skill bun-jest-migration -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install secondsky/claude-skills bun-jest-migration --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/plugins/bun/skills/bun-jest-migration .agents/skills/bun-jest-migration && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "bun-jest-migration" agent skill from https://github.com/secondsky/claude-skills/tree/main/plugins/bun/skills/bun-jest-migration into .agents/skills/bun-jest-migration/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bun-jest-migration", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add secondsky/claude-skills --skill bun-jest-migration -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install secondsky/claude-skills bun-jest-migration --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/plugins/bun/skills/bun-jest-migration .cursor/skills/bun-jest-migration && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "bun-jest-migration" agent skill from https://github.com/secondsky/claude-skills/tree/main/plugins/bun/skills/bun-jest-migration into .cursor/skills/bun-jest-migration/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bun-jest-migration", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/secondsky/claude-skills.git --path plugins/bun/skills/bun-jest-migration--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add secondsky/claude-skills --skill bun-jest-migration -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install secondsky/claude-skills bun-jest-migration --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/plugins/bun/skills/bun-jest-migration .gemini/skills/bun-jest-migration && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "bun-jest-migration" agent skill from https://github.com/secondsky/claude-skills/tree/main/plugins/bun/skills/bun-jest-migration into .gemini/skills/bun-jest-migration/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bun-jest-migration", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install secondsky/claude-skills bun-jest-migrationInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add secondsky/claude-skills --skill bun-jest-migration -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/plugins/bun/skills/bun-jest-migration .github/skills/bun-jest-migration && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "bun-jest-migration" agent skill from https://github.com/secondsky/claude-skills/tree/main/plugins/bun/skills/bun-jest-migration into .github/skills/bun-jest-migration/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bun-jest-migration", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add secondsky/claude-skills --skill bun-jest-migration -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install secondsky/claude-skills bun-jest-migration --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/plugins/bun/skills/bun-jest-migration .opencode/skills/bun-jest-migration && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "bun-jest-migration" agent skill from https://github.com/secondsky/claude-skills/tree/main/plugins/bun/skills/bun-jest-migration into .opencode/skills/bun-jest-migration/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bun-jest-migration", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
bun-jest-migrationA 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.
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.
5 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 8837836. It shows what the files ask for, not the result of running them.
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.
Shell commands in SKILL.md call:
bunjestFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
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.
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.
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.
The full file from secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 197 words, ~1,406 tokens.
.claude/skills/bun-jest-migration/SKILL.md (or your agent's skills folder).Bun's test runner is Jest-compatible. Most Jest tests run without changes.
# 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// 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";| 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 |
| 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 |
// 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');// 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')
}));// Jest
jest.spyOn(console, 'log').mockImplementation(() => {});
// Bun (identical)
spyOn(console, 'log').mockImplementation(() => {});// 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// Jest
expect(component).toMatchSnapshot();
expect(data).toMatchInlineSnapshot(`"expected"`);
// Bun (identical)
expect(component).toMatchSnapshot();
expect(data).toMatchInlineSnapshot(`"expected"`);Update snapshots:
bun test --update-snapshots// jest.config.js (before)
module.exports = {
testMatch: ['**/*.test.ts'],
testTimeout: 10000,
setupFilesAfterEnv: ['./jest.setup.ts'],
collectCoverage: true,
coverageThreshold: { global: { lines: 80 } }
};# bunfig.toml (after)
[test]
root = "./"
preload = ["./jest.setup.ts"]
timeout = 10000
coverage = true
coverageThreshold = 0.8jest.mock Not Working// 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');// 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
});// 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}`
};
}
});Remove Jest packages
bun remove jest ts-jest @types/jest babel-jest jest-environment-jsdomUpdate package.json
{
"scripts": {
"test": "bun test",
"test:watch": "bun test --watch",
"test:coverage": "bun test --coverage"
}
}Convert jest.config.js to bunfig.toml
Update imports in test files
@jest/globals → bun:testjest.fn() → mock()jest.mock() → mock.module()Run and fix
bun test 2>&1 | head -50 # Check first 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 |
Load references/compatibility-matrix.md when:
© secondsky, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in plugins/bun/skills/bun-jest-migration of secondsky/claude-skills.
Open the folder on GitHubat commit 8837836
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.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Bun Jest Migration this skillsecondsky/claude-skills | 227 | — | ~1.4k | Automated safety check: Pass | MIT | |
| Jest Testing PatternsChrisWiles/claude-code-showcase | 6.1k | 7 repos | ~1.5k | Automated safety check: Pass | None | |
| Vitestsupabase/supabase | 111k | 12 repos | ~1.1k | Automated safety check: Pass | Apache-2.0 | |
| Test GuardamElnagdy/guard-skills | 1.3k | 2 repos | ~2.1k | Automated safety check: Pass | MIT | |
| Vitestpixel-point/animate-text | 149 | 2 repos | ~1.3k | Automated safety check: Pass | None | |
| Test Guidelinesgetsentry/sentry-react-native | 1.8k | — | ~1.3k | Automated safety check: Pass | MIT |
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.
supabase/supabase
Vitest API and config reference (Jest-compatible) — mocking with vi., spies, fake timers, coverage configuration, fixtures, snapshots, and test filtering.
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.
pixel-point/animate-text
Vitest testing framework patterns for test setup, async testing, mocking with vi., snapshots, and test performance (formerly test-vitest).
getsentry/sentry-react-native
Enforce Sentry React Native SDK test conventions for naming, structure, mocking, and fixtures with Jest.
CloudAI-X/claude-workflow-v2
Designs and implements testing strategies for any codebase. An agent skill from CloudAI-X/claude-workflow-v2.
secondsky/claude-skills
TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.
secondsky/claude-skills
AutoAnimate (@formkit/auto-animate) zero-config animations for React.
secondsky/claude-skills
MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.
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"…
secondsky/claude-skills
Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).
secondsky/claude-skills
Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.
Works with
Categories
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.
Bun Jest Migration fits situations like: migrating from Jest to Buns test runner; import compatibility.
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.
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.
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.
Going by SKILL.md and its folder, Bun Jest Migration needs the command-line tools its instructions call (bun and jest).
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.
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.
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.
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.
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.
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.