Back to Skills

jest

verified

Provides comprehensive guidance for Jest testing framework including test writing, matchers, async testing, mocking, snapshots, configuration, and CLI. Use when the user asks about Jest, needs to write JavaScript/TypeScript tests, mock dependencies, or configure Jest for projects.

View on GitHub

Marketplace

full-stack-skills

partme-ai/full-stack-skills

Plugin

development-skills-utils

Repository

partme-ai/full-stack-skills
39stars

skills/jest/SKILL.md

Last Verified

February 1, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/partme-ai/full-stack-skills/blob/main/skills/jest/SKILL.md -a claude-code --skill jest

Installation paths:

Claude
.claude/skills/jest/
Powered by add-skill CLI

Instructions

## When to use this skill

Use this skill whenever the user wants to:
- Write unit tests and integration tests with Jest
- Set up Jest in a project
- Use Jest matchers and assertions
- Test asynchronous code
- Mock functions, modules, and dependencies
- Create snapshot tests
- Configure Jest for different environments
- Use Jest with TypeScript, React, Vue, or other frameworks
- Run tests and generate coverage reports
- Use Jest CLI commands
- Set up test environments (jsdom, node)
- Use Jest with Vite (via vite-jest, though Vitest is recommended for new Vite projects)

## How to use this skill

This skill is organized to match the Jest official documentation structure (https://jestjs.io/docs/getting-started, https://jestjs.io/docs/api). When working with Jest:

1. **Identify the topic** from the user's request:
   - Getting started/快速开始 → `examples/getting-started/installation.md` or `examples/getting-started/using-matchers.md`
   - Testing/测试 → `examples/testing/asynchronous.md` or `examples/testing/setup-teardown.md`
   - Mock functions/Mock 函数 → `examples/testing/mock-functions.md`
   - Mock modules/Mock 模块 → `examples/testing/manual-mocks.md`
   - Snapshots/快照 → `examples/testing/snapshot-testing.md`
   - Configuration/配置 → `examples/configuration/jest-config.md`
   - CLI/命令行 → `examples/configuration/cli-options.md`

2. **Load the appropriate example file** from the `examples/` directory:

   **Getting Started (快速开始) - `examples/getting-started/`**:
   - `examples/getting-started/installation.md` - Installing Jest and basic setup
   - `examples/getting-started/using-matchers.md` - Using Jest matchers and assertions

   **Testing (测试) - `examples/testing/`**:
   - `examples/testing/asynchronous.md` - Testing asynchronous code
   - `examples/testing/setup-teardown.md` - Setup and teardown functions
   - `examples/testing/mock-functions.md` - Mocking functions
   - `examples/testing/manual-mocks.md` - Manual mocks
   - `examples/testing/snapshot-testing.md` - Sna

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
6642 chars