From test-builder
Generate unit tests for functions, classes, or modules — isolated, fast, with edge cases and mocks
npx claudepluginhub silviaare95/xari-plugins --plugin test-builderThis skill uses the workspace's default tool permissions.
Guides reliable browser automation using Playwright and Puppeteer for web testing, scraping, and AI agent interactions. Covers selectors, waits, isolation, and anti-detection patterns.
Provides checklists to review code for functionality, quality, security, performance, tests, and maintainability. Use for PRs, audits, team standards, and developer training.
Enforces A/B test setup with gates for hypothesis locking, metrics definition, sample size calculation, assumptions checks, and execution readiness before implementation.
Generate unit tests for: $0
Framework: $1 (default: vitest)
Read the target code — Understand the function/class signature, dependencies, return types, and side effects.
Identify test cases — For each public function or method:
Design mocks — Identify external dependencies:
Write tests — Follow this structure:
import { describe, it, expect, vi } from "vitest";
import { targetFunction } from "./target";
describe("targetFunction", () => {
// Group by behavior, not by method
describe("when given valid input", () => {
it("returns the expected result", () => {
const result = targetFunction("valid");
expect(result).toEqual(expected);
});
});
describe("when given invalid input", () => {
it("throws a ValidationError", () => {
expect(() => targetFunction("")).toThrow(ValidationError);
});
});
describe("edge cases", () => {
it("handles empty arrays", () => {
expect(targetFunction([])).toEqual([]);
});
});
});
<name>.test.ts colocated or in __tests__/it("returns null when user is not found") not it("test 1")