vitest-testing

vitest-testing is a skill for Claude Code, Codex from existential-birds/beagle. It costs 55 tokens per session (982 once invoked), scanned A, original, Apache-2.0.

A skill for Vitest, a JavaScript and TypeScript testing framework. It covers test structure, assertions, setup hooks, mocking, snapshots, skipped or focused tests, and coverage configuration.

In plain words
What is it for?
Use it to write unit and integration tests with describe, it, expect, and beforeEach, mock functions or modules with vi, and configure Vitest projects and coverage.
Why use it?
It provides tested patterns for checking values, errors, objects, and asynchronous or isolated behavior. It also helps avoid common test-runner mistakes around clearing mocks and accidentally selecting only one test.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to write unit and integration tests with describe, it, expect, and beforeEach, mock functions or modules with vi, and configure Vitest projects and coverage.

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

Made for: Claude Code, Codex.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/existential-birds/beagle/vitest-testing"><img src="https://agentmods.dev/badge/skills/existential-birds/beagle/vitest-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 982 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. Third-party audits
  • Socket pass 18 Sept 2026
  • Snyk pass 18 Sept 2026
How audits are shown
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.00055 $0.00982
Opus 5.5 $0.00022 $0.00393
Sonnet 5.5 $0.00011 $0.00196
Haiku 4.5 $0.00006 $0.00098

Measured 4d ago against content hash 114be43e92fd, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

vitest-testing 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 4d 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/vitest-testing/SKILL.md · 109 lines

How it starts

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

Vitest Best Practices

Quick Reference

import { describe, it, expect, beforeEach, vi } from 'vitest'

describe('feature name', () => {
  beforeEach(() => {
    vi.clearAllMocks()
  })

  it('should do something specific', () => {
    expect(actual).toBe(expected)
  })

  it.todo('planned test')
  it.skip('temporarily disabled')
  it.only('run only this during dev')
})

Common Assertions

// Equality
expect(value).toBe(42)                    // Strict (===)
expect(obj).toEqual({ a: 1 })             // Deep equality
expect(obj).toStrictEqual({ a: 1 })       // Strict deep (checks types & undefined keys)

// Numbers & Strings/Arrays
expect(0.1 + 0.2).toBeCloseTo(0.3)
expect(str).toMatch(/pattern/)
expect(array).toContain(item)
expect(array).toHaveLength(3)

// Objects
expect(obj).toHaveProperty('nested.key', 'value')
expect(obj).toMatchObject({ subset: 'of properties' })

// Exceptions
expect(() => fn()).toThrow('error message')
expect(() => fn()).toThrow(/pattern/)

Async Testing

// Async/await (preferred)
it('fetches data', async () => {
  const data = await fetchData()
  expect(data).toEqual({ id: 1 })
})

// Promise matchers - ALWAYS await these
await expect(fetchData()).resolves.toEqual({ id: 1 })
await expect(fetchData()).rejects.toThrow('Error')

// Wrong - creates false positive
expect(promise).resolves.toBe(value)  // Missing await!

Quick Mock Reference

const mockFn = vi.fn()
mockFn.mockReturnValue(42)
mockFn.mockResolvedValue({ data: 'value' })

expect(mockFn).toHaveBeenCalled()
expect(mockFn).toHaveBeenCalledWith('arg1', 'arg2')
expect(mockFn).toHaveBeenCalledTimes(2)

For vi.hoisted(), vi.mock(), importOriginal, and mock cleanup, see references/mocking.md.

Verification gates

Use this sequence when you add or change tests; each step has an objective pass condition.

  1. Run the test suite — From the package or workspace root, run the same command CI uses (check package.json scripts; often vitest run, pnpm test, or npm test). Pass: exit code is 0 and the report shows zero failing tests.
  2. Async matchers — Pass: every expect(…).resolves and expect(…).rejects is prefixed with await (await expect(...)), as in Async Testing. A line where resolves or rejects appears without await fails this gate.
  3. Vitest v4 config compatibility — Pass: config uses top-level maxWorkers / isolate / fileParallelism (not removed v3 poolOptions), explicit coverage.include for AST coverage, and @vitest/browser-playwright (provider: playwright()) if Browser Mode is configured.

Read the full file on GitHub · 109 lines

Files

What ships with it

3 files 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. 4d ago Changed · -9 lines · -13 tokens per session 114be43e92fd
  2. 2mo ago First seen · 118 lines · 68 tokens per session scan A 936bd1d73c4f

Subscribe to this mod's changes

vitest-testing is a skill published in the GitHub repository existential-birds/beagle (91 stars, last pushed 4d ago), licensed Apache-2.0. It adds 55 tokens to every session and 982 once invoked, about $0.0002 per session on Opus 5.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-09-16.

Related

vitest-testing compared with skills from other repositories

vitest-testing next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
vitest-testingexistential-birds/beagleSkill914d agoApache-2.0A55Claude Code, Codex
write-testsGoldziher/ai-rulezSkill1826d agoMITA28Claude Code
Unit Test Scaffold (Python/pytest)s977043/river-reviewSkill8todayMITA19Claude Code
pythonUnique-Divine/jiyuuSkill7todayMITA30Claude Code, Codex
coding-standardsSimon-Hwang/gg-pluginsSkill24mo agononeA34Claude Code
codex-rule-routerSimon-Hwang/gg-pluginsSkill24mo agononeA39Claude Code
golang-testingaffaan-m/ECCSkill313k7d agoMITA37Claude Code, Kiro