js-testing

js-testing is a skill for Claude Code from iwritec0de/app-dev. It costs 100 tokens per session (5,952 once invoked), scanned A, original, MIT.

A guide to testing JavaScript and TypeScript applications with Vitest, a test runner, and React Testing Library, which checks what users see and do in a web interface.

In plain words
What is it for?
Writing component, API-route, hook, and integration tests, including realistic network mocks with Mock Service Worker.
Why use it?
It helps create tests that reflect real browser behaviour without depending on a component’s internal implementation.

Skill for Claude Code

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

Part of the app-dev plugin — 17 skills, 11 commands, 4 agents, 3 hooks shipped together

Good fit Writing component, API-route, hook, and integration tests, including realistic network mocks with Mock Service Worker.

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

Made for: Claude Code.

Or install app-dev, the plugin that ships this one along with the rest of its 17 skills, 11 commands, 4 agents, 3 hooks.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/iwritec0de/app-dev/js-testing"><img src="https://agentmods.dev/badge/skills/iwritec0de/app-dev/js-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 100 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,952 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.00100 $0.05952
Opus 5.5 $0.00040 $0.02381
Sonnet 5.5 $0.00020 $0.01190
Haiku 4.5 $0.00010 $0.00595

Measured 2mo ago against content hash ea0548d50d21, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

js-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 2mo 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/js-testing/SKILL.md · 921 lines

How it starts

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

JS Testing Skill — Vitest + React Testing Library for Next.js

Critical Rules

  1. Vitest is the test runner. Do not use Jest. All configuration, mocking, and assertions use the Vitest API (vi.fn(), vi.mock(), vi.spyOn(), etc.).
  2. React Testing Library (RTL) for component tests. Query elements the way a user would find them — by role, label, text, or placeholder. Never reach for getByTestId unless no semantic query is possible.
  3. Test user behavior, not implementation. Assert what the user sees and can interact with. Do not assert on component state, refs, internal variables, or hook return values directly (except when using renderHook).
  4. Never test React internals. Do not mock useState, useEffect, useRef, or any React built-in. If you need to control what a hook returns, extract the logic into a custom hook and test it with renderHook.
  5. Use MSW for API mocking. Mock at the network layer with Mock Service Worker, not by stubbing fetch or axios directly. This gives realistic request/response cycles and catches serialization issues.
  6. Prefer userEvent over fireEvent. userEvent simulates real browser behavior (focus, blur, keystrokes). fireEvent dispatches synthetic DOM events and should only be used for events userEvent does not support.
  7. Every test file must be self-contained. Shared setup belongs in vitest.setup.ts or a dedicated test utility file, not scattered across tests via implicit globals.

Component Testing

Basic Render Test

// components/greeting.tsx
export function Greeting({ name }: { name: string }) {
  return <h1>Hello, {name}!</h1>;
}
// components/greeting.test.tsx
import { render, screen } from "@testing-library/react";
import { describe, it, expect } from "vitest";
import { Greeting } from "./greeting";

describe("Greeting", () => {
  it("renders the user name", () => {
    render(<Greeting name="Kelley" />);

    expect(
      screen.getByRole("heading", { name: /hello, kelley/i })
    ).toBeInTheDocument();
  });
});

Read the full file on GitHub · 921 lines

Files

What ships with it

2 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. 2mo ago First seen · 921 lines · 100 tokens per session scan A ea0548d50d21

Subscribe to this mod's changes

js-testing is a skill published in the GitHub repository iwritec0de/app-dev (3 stars, last pushed 7mo ago), licensed MIT. It adds 100 tokens to every session and 5,952 once invoked, about $0.0004 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-08-31.

Related

js-testing compared with skills from other repositories

js-testing next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
js-testingiwritec0de/app-devSkill37mo agoMITA100Claude Code
r-testthatposit-dev/skillsSkill5675d agoMITA77Claude Code
r-package-developmentposit-dev/skillsSkill5675d agoMITA41Claude Code
cloudflare-workers-testingsecondsky/claude-skillsSkill25017d agoMITA57Claude Code
bun-test-lifecyclesecondsky/claude-skillsSkill25017d agoMITA27Claude Code
bun-test-mockingsecondsky/claude-skillsSkill25017d agoMITA25Claude Code
bun-test-basicssecondsky/claude-skillsSkill25017d agoMITA28Claude Code