generate-tests

Generate unit, integration, and end-to-end tests for NestJS modules.

13|1|Updated Jun 28, 2023
One-click install
npx skills add https://github.com/jovicon/nestjs-clean-architecture-event-driven-template --skill generate-tests-jovicon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: generate-tests
Source: https://github.com/jovicon/nestjs-clean-architecture-event-driven-template/tree/main/.claude/skills/generate-tests
Command: npx skills add https://github.com/jovicon/nestjs-clean-architecture-event-driven-template --skill generate-tests-jovicon

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generating and maintaining tests across use cases, entities, repositories, and endpoints is time-consuming and error-prone; this skill automates the process to improve coverage and reliability.

Core Features & Use Cases

  • Auto-generates unit tests for use cases, domain entities, repositories, and HTTP controllers following project conventions.
  • Creates integration and end-to-end tests with mock services and fixtures to validate real-world flows.
  • Provides test templates and guidance to ensure consistent quality and rapid onboarding when adding tests for existing code or new features.
  • Supports edge-case coverage, error handling, and side effects like domain events where applicable.

Quick Start

Provide the target module path and test type, then run the generator to produce a complete test suite.

Frequently Asked Questions about generate-tests

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

FAQPage Schema
How do I generate unit tests for NestJS modules automatically?

To generate unit tests for NestJS modules automatically, provide the target module path and test type to the generator. It produces a complete test suite for use cases, domain entities, repositories, and HTTP controllers following your project conventions.

What's the best way to create integration and e2e tests for NestJS controllers?

Creating integration and e2e tests for NestJS controllers is handled by generating test suites with mock services and fixtures. This approach validates real-world flows and HTTP endpoints while targeting complete coverage of statements, branches, functions, and lines.

Can I use mock services and fixtures to cover edge cases in NestJS testing?

Yes, you can use mock services and fixtures to cover edge cases in NestJS testing. The generator supports edge-case coverage, error handling, and side effects like domain events where applicable, ensuring consistent quality and reliable test validation.

Does automated test generation work for existing NestJS codebases needing higher coverage?

Automated test generation works for existing NestJS codebases requiring higher coverage by replacing manual, error-prone test-writing. It provides test templates and guidance to ensure consistent quality and rapid onboarding when adding tests for existing code or new features.

Why does maintaining tests across use cases and entities become error-prone manually?

Maintaining tests across use cases and entities becomes error-prone manually because generating and sustaining comprehensive tests for repositories and endpoints is time-consuming. Automating this process improves coverage and reliability by targeting complete statements, branches, functions, and lines.

What limitations should I expect when generating tests for domain events and side effects?

When generating tests for domain events and side effects, coverage targets edge cases, error handling, and applicable side effects. Limitations depend on whether the existing codebase exposes domain events correctly, as the generator relies on project conventions and mock services for validation.