gen-tests

gen-tests is a command for Claude Code from Insight-Services-APAC/ingenious. It costs 0 tokens per session (835 once invoked), scanned A, original, MIT.

A command that creates unit tests with Vitest and end-to-end browser tests with Playwright for JavaScript or TypeScript code. Unit tests check individual pieces; end-to-end tests check a complete user flow in a browser.

In plain words
What is it for?
Use it to review existing coverage and generate tests for uncovered modules, including browser-based flows.
Why use it?
It identifies code with little test coverage and adds checks for normal cases, edge cases, errors, and external dependencies.

Command for Claude Code

Written for Claude Code: installed under .claude/.

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.

agentmods
npx agentmods add commands/insight-services-apac/ingenious/gen-tests
Clone the repo
git clone --depth 1 https://github.com/Insight-Services-APAC/ingenious

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 gen-tests

README.md
[![agentmods](https://agentmods.dev/badge/commands/insight-services-apac/ingenious/gen-tests.svg)](https://agentmods.dev/commands/insight-services-apac/ingenious/gen-tests)
Your own site
<a href="https://agentmods.dev/commands/insight-services-apac/ingenious/gen-tests"><img src="https://agentmods.dev/badge/commands/insight-services-apac/ingenious/gen-tests.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 835 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00000 $0.00835
Opus 5 $0.00000 $0.00417
Sonnet 5 $0.00000 $0.00167
Haiku 4.5 $0.00000 $0.00084

Measured yesterday against content hash f6eb782f342b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

gen-tests 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 yesterday.

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.

.claude/commands/quality/js-quality/gen-tests.md · 117 lines

How it starts

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

Generate Tests

Generate comprehensive tests for the JavaScript/TypeScript codebase, including unit tests (Vitest) and end-to-end browser tests (Playwright).

Step 1: Analyze Existing Test Coverage

  1. Check if tests exist:

    npm test -- --coverage 2>/dev/null || echo "No tests found or coverage not configured"
    
  2. If using Vitest with coverage:

    npx vitest run --coverage
    
  3. Identify untested or under-tested modules by reviewing the coverage report.

Step 2: Generate Unit Tests (Vitest)

For each module or function lacking coverage:

  1. Analyze the code - understand inputs, outputs, side effects, and edge cases

  2. Create test file - follow the naming convention <module>.test.ts or __tests__/<module>.test.ts

  3. Write tests covering:

    • Happy path scenarios
    • Edge cases (empty inputs, boundary values, null/undefined handling)
    • Error conditions and exception handling
    • Mocked external dependencies (APIs, stores)
  4. Use test utilities for common setup in test helpers

Example test structure:

import { describe, it, expect, vi, beforeEach } from 'vitest';
import { functionUnderTest } from './module';

describe('functionUnderTest', () => {
  beforeEach(() => {
    vi.clearAllMocks();
  });

  it('should return expected result for valid input', () => {
    const result = functionUnderTest('valid');
    expect(result).toBe('expected');
  });

  it('should throw error for invalid input', () => {
    expect(() => functionUnderTest(null)).toThrow();
  });
});
  1. Run and verify:
    npx vitest run <test-file>
    

Step 3: Generate E2E Browser Tests (Playwright)

If the project has web routes/UI components:

  1. Create E2E test directory: tests/e2e/

  2. Write E2E tests in tests/e2e/<feature>.spec.ts:

    • Test critical user flows (navigation, form submissions)
    • Test UI state changes and interactions
    • Test API responses via the browser
    • Use page.goto(), page.click(), page.fill(), expect() assertions

Read the full file on GitHub · 117 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. yesterday First seen · 117 lines · 0 tokens per session scan A f6eb782f342b

Subscribe to this mod's changes

gen-tests is a command published in the GitHub repository Insight-Services-APAC/ingenious (24 stars, last pushed 7mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 835 tokens. 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-04.