add-tests

Generate Vitest-based unit tests for NestJS services, resolvers, or controllers.

30|3|Updated Mar 8, 2020
One-click install
npx skills add https://github.com/uxname/liteend --skill add-tests-uxname
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-tests
Source: https://github.com/uxname/liteend/tree/main/.agents/skills/add-tests
Command: npx skills add https://github.com/uxname/liteend --skill add-tests-uxname

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Write unit tests for an existing NestJS service, resolver, or controller in the project using Vitest and NestJS testing conventions.

Core Features & Use Cases

  • Co-located tests: place <name>.spec.ts next to the source file to keep tests close to implementation.
  • Mocking guidance: use Prisma-style mocks and Nest TestingModule to isolate behavior.
  • Coverage goals: ensure happy path, edge cases, and error handling are exercised.

Quick Start

Provide the path to the target file to generate or augment a unit test scaffold next to the file.

Frequently Asked Questions about add-tests

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

FAQPage Schema
How do I generate unit tests for a NestJS service using Vitest?

To generate Vitest unit tests for a NestJS service, provide the target file path. The tool inspects the source and creates a matching .spec.ts file with Nest TestingModule mocks covering happy paths and errors.

What is the best way to mock dependencies in a NestJS Vitest spec file?

The best way to mock dependencies in a NestJS Vitest spec file is using Nest testing module patterns. The generated tests apply Prisma-style mocks to isolate behavior effectively.

Does this testing approach co-locate spec files with the source code?

Yes, this testing approach co-locates spec files. It places the generated <name>.spec.ts file directly next to your existing NestJS service, resolver, or controller source file to keep tests close.

Can I use this to scaffold tests for NestJS controllers and resolvers?

Yes, you can scaffold tests for NestJS controllers and resolvers. The tool generates Vitest test files for any existing service, resolver, or controller by inspecting the target source code.

What testing scenarios are covered by the generated Vitest spec files?

The generated Vitest spec files cover happy path, edge cases, and error handling scenarios. This ensures comprehensive coverage for your NestJS components under the project's Vitest configuration.