unit-test-generator

Generates Jest, Vitest, or Jasmine unit tests with AAA pattern and mocked dependencies.

1|Updated Oct 11, 2025
One-click install
npx skills add https://github.com/codewizwit/human-in-the-loop --skill unit-test-generator-codewizwit
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: unit-test-generator
Source: https://github.com/codewizwit/human-in-the-loop/tree/main/lib/skills/unit-test-generator
Command: npx skills add https://github.com/codewizwit/human-in-the-loop --skill unit-test-generator-codewizwit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing thorough unit tests by hand is slow and often skipped, leaving source files untested and edge cases uncovered. This Skill analyzes workspace code, detects the testing framework, and writes complete test files covering happy paths, edge cases, and error scenarios. ## Core Features & Use Cases - Framework Detection: Reads package.json to auto-detect Jest, Vitest, or Jasmine and matches existing project test conventions. - Comprehensive Coverage: Generates tests following the Arrange-Act-Assert pattern with happy paths, boundary conditions, invalid inputs, and exception handling. - Mocking Strategy: Mocks external dependencies like APIs, databases, and file systems while never mocking the code under test. - Use Case: Point it at a directory of untested service files and receive runnable spec files with AI-generated markers flagging areas for human review before committing. ## Quick Start Ask the assistant to find all files without tests in your workspace and generate comprehensive unit tests for them.

Frequently Asked Questions about unit-test-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate unit tests for untested files in my project?▼

Ask the assistant to find files without tests and generate unit tests. It uses Glob to locate source files lacking corresponding test files, analyzes each file's exports and dependencies, then writes complete test suites following your project's conventions.

Jest vs Vitest vs Jasmine for unit testing?▼

The skill supports all three and can auto-detect which one your project uses by reading package.json. It matches the detected framework's syntax and your existing file naming conventions, such as .spec.ts or .test.ts.

Does the test generator handle mocking of external dependencies?▼

Yes, it mocks external dependencies like APIs, databases, and file systems, and uses spies to verify function calls. It never mocks the module under test itself, keeping tests focused on real behavior.

Can I generate tests for only one specific file?▼

Yes, you can target a specific file or directory, such as src/utils/helpers.ts. The skill reads that file, identifies all exported functions and classes, and produces a focused test file with happy path, edge case, and error handling coverage.

What are the limitations of AI-generated unit tests?▼

Generated tests are marked with AI-generated review markers and TODO comments because they require human review before committing. They may miss domain-specific business logic nuances, so edge cases flagged for review should be verified and expanded manually.