bun-jest-migration
FeaturedUse when migrating from Jest to Bun's test runner, import compatibility, mocks, and config.
Testing & QA 221 stars
31 forks Updated today MIT
Install
Quality Score: 91/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# 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()` |
| `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
```typescript
// 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'...
Details
- Author
- secondsky
- Repository
- secondsky/claude-skills
- Created
- 10 months ago
- Last Updated
- today
- Language
- TypeScript
- License
- MIT
Integrates with
Similar Skills
Semantically similar based on skill content — not just same category
Testing & QA Featured
bun-test-basics
Use for bun:test syntax, assertions, describe/it, test.skip/only/each, and basic patterns.
221 Updated today
secondsky Testing & QA Listed
testing-bun
Use when writing or modifying tests in a Bun project
3 Updated today
LandonSchropp Testing & QA Featured
bun-test-mocking
Use for mock functions in Bun tests, spyOn, mock.module, implementations, and test doubles.
221 Updated today
secondsky