vitest-testing

vitest-testing is a skill for Claude Code, Codex from monkilabs/opencastle. It costs 38 tokens per session (518 once invoked), scanned A, original, MIT.

Testing guidance for Vitest, a JavaScript and TypeScript test runner. It covers unit and integration tests, mocks, test commands, and coverage reports.

In plain words
What is it for?
Use it to write tests for functions and components, test larger flows, mock dependencies, run tests locally or in CI, and measure coverage.
Why use it?
It provides a consistent way to check code behavior and catch regressions. It also explains how to run selected tests, use mocks, and produce coverage results for CI.

Skill for Claude CodeCodex

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

Good fit Use it to write tests for functions and components, test larger flows, mock dependencies, run tests locally or in CI, and measure coverage.

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

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/monkilabs/opencastle/vitest-testing/github.svg)](https://agentmods.dev/skills/monkilabs/opencastle/vitest-testing)
Your own site
<a href="https://agentmods.dev/skills/monkilabs/opencastle/vitest-testing"><img src="https://agentmods.dev/badge/skills/monkilabs/opencastle/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/monkilabs/opencastle/vitest-testing"><img src="https://agentmods.dev/badge/skills/monkilabs/opencastle/vitest-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 518 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.00038 $0.00518
Opus 5.5 $0.00015 $0.00207
Sonnet 5.5 $0.00008 $0.00104
Haiku 4.5 $0.00004 $0.00052

Measured 11d ago against content hash a1d7947d5698, 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 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.

src/orchestrator/plugins/vitest/skills/vitest-testing/SKILL.md · 30 lines

What it actually says

Vitest Testing

Project test configuration: .opencastle/stack/testing-config.md. Coverage thresholds, environment and setup files: the project's vitest.config.* (or the test block of vite.config.*) — read them, never assume a number.

Running

  • vitest alone starts watch mode in a terminal and never exits. Agents run vitest run [file] [-t "name"].
  • Type tests (*.test-d.ts, expectTypeOf) run with vitest --typecheck (or vitest run --typecheck). The old vitest typecheck subcommand is gone since 1.0.
  • Coverage: vitest run --coverage. Below threshold → read the uncovered lines in the text report, add tests for those branches, re-run.

Mocking gotchas

  • vi.mock() is hoisted above every import, so its factory cannot use variables declared in the file. Declare them with vi.hoisted():

    const { getUser } = vi.hoisted(() => ({ getUser: vi.fn() }))
    vi.mock('./database', () => ({ getUser }))
    
  • Partial mock: vi.mock('./config', async (importOriginal) => ({ ...(await importOriginal<typeof import('./config')>()), API_URL: 'http://test' })).

  • vi.spyOn(namespace, 'fn') on a module's export misses calls made inside that module, and fails in Browser Mode; mock the module instead.

  • vi.restoreAllMocks() only restores vi.spyOn spies (Vitest 3+). It does not reset vi.fn() call history; use vi.clearAllMocks(), or restoreMocks / clearMocks in the config, so state cannot leak between tests.

  • Fake timers: vi.useFakeTimers() in beforeEach, vi.useRealTimers() in afterEach; advance with vi.advanceTimersByTime(ms) or await vi.advanceTimersByTimeAsync(ms) when promises are involved.

  • One file needs a DOM in a node project: // @vitest-environment jsdom on its first line.

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 Changed · -133 lines · -2 tokens per session a1d7947d5698
  2. 12d ago First seen · 163 lines · 40 tokens per session scan A c98fe36d64eb

Subscribe to this mod's changes

vitest-testing is a skill published in the GitHub repository monkilabs/opencastle (80 stars, last pushed yesterday), licensed MIT. It adds 38 tokens to every session and 518 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-10-04.

Related

Other skills, from other repositories

testing-pyramid

Use when writing tests of any kind — unit, slice, or integration. Covers test structure, naming conventions, Mockito patterns, @WebMvcTest, @DataJpaTest, and Testcontainers setup.

rrezartprebreza/spring-boot-skills · 44 tokens

testing-patterns

Testing patterns and principles. Unit, integration, mocking strategies.

DDS-Solutions/AI-TadPole-OS · 16 tokens

angular-testing

Reviews Angular test suite conventions. Flags component tests that query the DOM by CSS class/tag instead of accessible role/label, HTTP calls in component tests hitting a real HttpClient instead of HttpTestingController, Angular Material components tested via raw DOM queries instead of Component Test Harnesses, no…

AgenticPawan/FullStack-Pilot · 92 tokens

migrate-xunit-to-xunit-v3

Migrate .NET test projects from xUnit.net v2 to xunit.v3 and fix v3 breaks. Use for package/CPM conversion, OutputType=Exe, preserving the VSTest or MTP runner (including projects currently using YTest.MTP.XUnit2), incompatible TFMs, async void tests, string-to-Type attributes, custom Fact/Theory/BeforeAfterTest…

dotnet/skills · 149 tokens

dart-test

DART Test: unit tests, integration tests, CI validation, and debugging.

dartsim/dart · 18 tokens

principle-test-behavior-not-implementation

Apply when you write, change, or keep a test. Assert what the code's users can observe, so that the test fails when that behavior breaks and keeps passing when only the internals change.

michael-denyer/pstack-claude · 50 tokens