bun-jest-migration

仓库创建 2025年11月8日最近提交 29 天前SkillHot 收录 22 天前
▸ 精选理由

对想借助 Bun 提升测试速度的项目迁移很实用。

这个 Skill 做什么

指导从 Jest 迁移到 Bun 测试运行器的步骤与注意点。

给从 Jest 迁移到 Bun 测试运行器的实操指南,涵盖依赖移除、测试脚本更新、导入兼容性和 mock 相关调整。适用于想把测试跑在 Bun 上、利用其更快启动和兼容 Jest 的场景。特别说明 Bun 的 test runner 与 Jest 高度兼容,很多测试无需改动,但也列出常见问题和配置注意点。

▸ 展开 SKILL.md 英文原文

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

开发编程测试迁移JestBun兼容性通用
180
Stars
28
Forks
40
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/secondsky/claude-skills/main/plugins/bun/skills/bun-jest-migration/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/secondsky/claude-skills/main/plugins/bun/skills/bun-jest-migration/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# 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

| Jest | Bun | Notes |
|------|-----|-------|
| `describe()` | `describe()` | Identical |
| `it()` / `test()` | `test()` | Use `test()`
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有