jest-vitest

jest-vitest is a skill for Claude Code from aks-builds/quality-skills. It costs 132 tokens per session (3,041 once invoked), scanned A, original, MIT.

A guide for writing tests with Jest or Vitest, JavaScript and TypeScript test runners. It covers unit, component, and integration tests, including mocks, asynchronous code, timers, and configuration.

In plain words
What is it for?
Use it to create or improve tests for JavaScript or TypeScript code, including React, Vue, Svelte, Solid, and Node projects.
Why use it?
It helps structure tests correctly and avoid problems caused by module systems, asynchronous behavior, time, randomness, and framework-specific setup.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the quality-skills plugin — 57 skills shipped together

Good fit Use it to create or improve tests for JavaScript or TypeScript code, including React, Vue, Svelte, Solid, and Node projects.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aks-builds/quality-skills/jest-vitest
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 aks-builds/quality-skills --skill jest-vitest
Clone the repo
git clone --depth 1 https://github.com/aks-builds/quality-skills

Made for: Claude Code.

Or install quality-skills, the plugin that ships this one along with the rest of its 57 skills.

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-vitest

README.md
[![agentmods](https://agentmods.dev/badge/skills/aks-builds/quality-skills/jest-vitest/github.svg)](https://agentmods.dev/skills/aks-builds/quality-skills/jest-vitest)
Your own site
<a href="https://agentmods.dev/skills/aks-builds/quality-skills/jest-vitest"><img src="https://agentmods.dev/badge/skills/aks-builds/quality-skills/jest-vitest/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-vitest

Your own site · 80×15
<a href="https://agentmods.dev/skills/aks-builds/quality-skills/jest-vitest"><img src="https://agentmods.dev/badge/skills/aks-builds/quality-skills/jest-vitest.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 132 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,041 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.00132 $0.03041
Opus 5 $0.00066 $0.01520
Sonnet 5 $0.00026 $0.00608
Haiku 4.5 $0.00013 $0.00304

Measured 11d ago against content hash 42c54218bd82, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

jest-vitest 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 11d 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.

skills/jest-vitest/SKILL.md · 313 lines

How it starts

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

Jest & Vitest

You are an expert in both Jest and Vitest — the dominant JS/TS unit test runners. Your goal is to help engineers structure tests, mock effectively, handle async correctly, manage time and randomness, and pick between the two tools when relevant. Don't fabricate matcher names, mock APIs, or config keys. When uncertain, point the reader to jestjs.io or vitest.dev.

Initial Assessment

Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:

  • Which runner? — Jest (mature, broad ecosystem, slower) or Vitest (faster, Vite-based, smaller ecosystem). Vitest is largely API-compatible with Jest, so most patterns transfer.
  • Module system — ESM vs CJS. Jest historically struggled with ESM; Vitest is ESM-native. Knowing the module setup avoids hours of debugging.
  • TS vs JS — TypeScript adds setup considerations (ts-jest, @swc/jest, Vitest's built-in support).
  • Framework on top — React (React Testing Library), Vue (Vue Test Utils), Svelte, Solid, plain Node. Test patterns are similar; rendering helpers differ.
  • Test scope — unit (pure functions), component (UI render + assertion), integration (multiple modules + mocked I/O), or hybrid.

If the file does not exist, ask: Jest or Vitest, ESM or CJS, TypeScript, UI framework if any, and intended scope.


Why one over the other

Pick Jest when… Pick Vitest when…
Existing Jest investment Greenfield project on Vite
React Native (Jest is the default) ESM-native code
Need every Jest plugin under the sun Care about test runtime / DX
CI infrastructure already wired for Jest Vue / Svelte / Solid project using Vite
Module-mocking patterns very deeply set Want browser-mode tests via Vitest

If you're starting fresh and not React-Native-bound, Vitest is the modern default for most Node/web projects. If you're maintaining a large suite, the migration is workable but not free — most APIs match but mock semantics differ in edge cases.

Read the full file on GitHub · 313 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 11d ago First seen · 313 lines · 132 tokens per session scan A 42c54218bd82

Subscribe to this mod's changes

jest-vitest is a skill published in the GitHub repository aks-builds/quality-skills (2 stars, last pushed yesterday), licensed MIT. It adds 132 tokens to every session and 3,041 once invoked, about $0.0007 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

test-case-writer

Use when someone asks to generate test cases, write test cases from a user story, create test cases from a BRD, design test cases from a mockup or wireframe, or produce a test case table from requirements.

ukkuru/testmetry-skills · 50 tokens

review-ugc-render

Mandatory pre-publish review gate for a UGC video render. Transcribes the finished render's AUDIO with Whisper and word-diffs it against the approved spoken script, then gates setfinalrender — blocking a render whose generated audio mis-voices a word (e.g. the approved "human-vetted" spoken as "human witted"), drops…

gooseworks-ai/goose-skills · 116 tokens

test-generator

A test-writing helper that creates unit or integration tests from the code's actual behavior and contracts. Unit tests check small pieces of code, while integration tests check how real components work together.

laolaoshiren/claude-code-skills-zh · 79 tokens

testing-r-packages

Best practices for writing R package tests using testthat version 3+. Use when writing, organizing, or improving tests for R packages. Covers test structure, expectations, fixtures, snapshots, mocking, and modern testthat 3 patterns including self-sufficient tests, proper cleanup with withr, and snapshot testing.

posit-dev/skills · 67 tokens

r-package-development

R package development with devtools, testthat, and roxygen2. Use when the user is working on an R package, running tests, writing documentation, or building package infrastructure.

posit-dev/skills · 41 tokens

111-java-maven-dependencies

Use when you need to add or evaluate Maven dependencies that improve code quality or domain modeling — including nullness annotations (JSpecify), static analysis (Error Prone + NullAway), functional programming (VAVR), architecture testing (ArchUnit), or money and currency support (JavaMoney) — and want a…

jabrena/plinth · 133 tokens