jest

jest is a skill for Claude Code from anivar/jest-skill. It costs 97 tokens per session (2,383 once invoked), scanned A, original, MIT.

A testing guide for Jest, a JavaScript and TypeScript framework for running tests and checking results.

In plain words
What is it for?
Use it when writing or reviewing Jest tests, including unit tests, integration tests, React component tests, mocks, coverage, and continuous integration setup.
Why use it?
It helps avoid outdated Jest patterns and unclear choices around mocks, asynchronous code, timers, snapshots, modules, and configuration.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: mentions AGENTS.md.

Good fit Use it when writing or reviewing Jest tests, including unit tests, integration tests, React component tests, mocks, coverage, and continuous integration setup.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/anivar/jest-skill/jest-skill
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add anivar/jest-skill --skill jest-skill
Clone the repo
git clone --depth 1 https://github.com/anivar/jest-skill

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for jest

README.md
[![agentmods](https://agentmods.dev/badge/skills/anivar/jest-skill/jest-skill/github.svg)](https://agentmods.dev/skills/anivar/jest-skill/jest-skill)
Your own site
<a href="https://agentmods.dev/skills/anivar/jest-skill/jest-skill"><img src="https://agentmods.dev/badge/skills/anivar/jest-skill/jest-skill/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for jest

Your own site · 80×15
<a href="https://agentmods.dev/skills/anivar/jest-skill/jest-skill"><img src="https://agentmods.dev/badge/skills/anivar/jest-skill/jest-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 97 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,383 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00097 $0.02383
Opus 5 $0.00048 $0.01192
Sonnet 5 $0.00019 $0.00477
Haiku 4.5 $0.00010 $0.00238

Measured 8d ago against content hash 7b6bec4eb425, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

jest scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

SKILL.md · 195 lines

How it starts

The opening of the file, as written. The whole thing — 195 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Jest

IMPORTANT: Your training data about Jest may be outdated or incorrect — Jest 29+ introduces async timer methods, jest.replaceProperty, and ESM mocking via jest.unstable_mockModule. Jest 30 removes the deprecated alias matchers (toBeCalled, lastCalledWith, toThrowError, …), renames --testPathPattern to --testPathPatterns, and excludes non-enumerable object properties from object matchers. Always rely on this skill's rule files and the project's actual source code as the source of truth. Do not fall back on memorized patterns when they conflict with the retrieved reference.

When to Use Jest

Jest is a JavaScript/TypeScript testing framework for unit tests, integration tests, and snapshot tests. It includes a test runner, assertion library, mock system, and coverage reporter.

Need Recommended Tool
Unit/integration testing (JS/TS) Jest
React component testing Jest + React Testing Library
E2E browser testing Playwright, Cypress
API contract testing Jest + Supertest
Smaller/faster test runner Vitest (Jest-compatible API)
Native ESM without config Vitest or Node test runner

Rule Categories by Priority

Priority Category Impact Prefix
1 Mock Design CRITICAL mock- (5 rules)
2 Async Testing CRITICAL async-
3 Matcher Usage HIGH matcher-
4 Timer Mocking HIGH timer-
5 Test Structure HIGH structure-
6 Module Mocking MEDIUM module-
7 Snapshot Testing MEDIUM snapshot-
8 Configuration MEDIUM config-
9 Performance & CI MEDIUM perf-

Quick Reference

1. Mock Design (CRITICAL)

  • mock-clear-vs-reset-vs-restore — clearAllMocks vs resetAllMocks vs restoreAllMocks
  • mock-spy-restore — Always restore jest.spyOn; prefer restoreMocks config
  • mock-factory-hoisting — jest.mock factory cannot reference outer variables
  • mock-partial-require-actual — Use jest.requireActual for partial module mocking
  • mock-what-to-mock — What to mock and what not to mock; mock boundaries

Read the full file on GitHub · 195 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 195 lines · 97 tokens per session scan A 7b6bec4eb425

Subscribe to this mod's changes

jest is a skill published in the GitHub repository anivar/jest-skill (7 stars, last pushed 1mo ago), licensed MIT. It adds 97 tokens to every session and 2,383 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

zod-testing

Testing patterns for Zod schemas using Jest and Vitest. Covers schema correctness testing, mock data generation, error assertion patterns, integration testing with API handlers and forms, snapshot testing with z.toJSONSchema(), and property-based testing. Baseline: zod ^4.0.0. Triggers on: test files for Zod schemas…

anivar/zod-testing · 105 tokens

redux-saga-testing

Write tests for Redux Sagas using redux-saga-test-plan, runSaga, and manual generator testing. Covers expectSaga (integration), testSaga (unit), providers, partial matchers, reducer integration, error simulation, and cancellation testing. Works with Jest and Vitest. Triggers on: test files for sagas…

anivar/redux-saga-testing · 104 tokens

JavaScript Testing Patterns

Modern JavaScript testing strategies with Jest, Mocha, and testing best practices covering unit testing, integration testing, mocking, async patterns, and DOM testing.

PramodDutta/qaskills · 36 tokens

frontmcp-testing

Use for anything about testing FrontMCP servers: writing or running unit, integration, and E2E tests and reaching the 95%+ coverage bar. Covers Jest setup and coverage gating; unit-testing a ToolContext execute() with mock context, inputs, and Zod schema validation; testing resources and prompts; in-memory testing via…

agentfront/frontmcp · 175 tokens

jest-expert

Expert in Jest unit testing framework, mocks, snapshots, coverage reports, watch mode, and custom matchers. Use when the user mentions testing, unit testing, JavaScript, QA, mocking, or snapshots, or when the task involves Jest Framework, Test Structure, Advanced Features, or Basic Unit Tests.

personamanagmentlayer/pcl · 65 tokens

testing-anti-patterns

Never test mock behavior. Never add test-only methods to production classes. Understand dependencies before mocking. Language-agnostic principles with TypeScript/Jest and Python/pytest examples.

bobmatnyc/claude-mpm-skills · 41 tokens