Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

typescript-unit-testing

БесплатноБез исполняемых скриптовНе проверен

Unit testing for TypeScript/NestJS projects using Jest, @golevelup/ts-jest (DeepMocked/createMock), and in-memory databases, with AAA structure. Use whenever…

bmad-labsот bmad-labs★ 20 звёзд на GitHub

Об этом скилле

Unit Testing Skill

Unit testing validates individual functions, methods, and classes in isolation by mocking all external dependencies.


Contents

Workflows

For guided, step-by-step execution of unit testing tasks, use the appropriate workflow:

Workflow Purpose When to Use
Setup Initialize test infrastructure New project or missing test setup
Writing Write new unit tests Creating tests for components
Reviewing Review existing tests Code review, quality audit
Running Execute tests Running tests, analyzing results
Debugging Fix failing tests Tests failing, need diagnosis
Optimizing Improve test performance Slow tests, maintainability

Workflow Selection Guide

IMPORTANT: Before starting any testing task, identify the user's intent and load the appropriate workflow.

Detect User Intent → Select Workflow

User Says / Wants Workflow to Load File
"Set up tests", "configure Jest", "add testing to project", "install test dependencies" Setup workflows/setup/workflow.md
"Write tests", "add tests", "create tests", "test this service/controller" Writing workflows/writing/workflow.md
"Review tests", "check test quality", "audit tests", "are these tests good?" Reviewing workflows/reviewing/workflow.md
"Run tests", "execute tests", "check if tests pass", "show test results" Running workflows/running/workflow.md
"Fix tests", "debug tests", "tests are failing", "why is this test broken?" Debugging workflows/debugging/workflow.md
"Speed up tests", "optimize tests", "tests are slow", "fix open handles" Optimizing workflows/optimizing/workflow.md

Workflow Execution Protocol

  1. ALWAYS load the workflow file first - Read the full workflow before taking action
  2. Follow each step in order - Complete checkpoints before proceeding
  3. Load knowledge files as directed - Each workflow specifies which references/ files to read
  4. Verify compliance after completion - Re-read relevant reference files to ensure quality

Knowledge Base Structure

references/
├── common/              # Core testing fundamentals
│   ├── knowledge.md     # Testing philosophy and test pyramid
│   ├── rules.md         # Mandatory testing rules (AAA, naming, coverage)
│   ├── assertions.md    # Assertion patterns and matchers
│   ├── examples.md      # Comprehensive examples by category
│   ├── detect-open-handles.md   # Open handle detection and cleanup
│   └── performance-optimization.md  # Jest runtime optimization
│
├── nestjs/              # NestJS component testing
│   ├── services.md      # Service/usecase testing patterns
│   ├── controllers.md   # Controller testing patterns
│   ├── guards.md        # Guard testing patterns
│   ├── interceptors.md  # Interceptor testing patterns
│   └── pipes-filters.md # Pipe and filter testing
│
├── mocking/             # Mock patterns and strategies
│   ├── deep-mocked.md   # @golevelup/ts-jest patterns
│   ├── jest-native.md   # Jest.fn, spyOn, mock patterns
│   └── factories.md     # Test data factory patterns
│
├── repository/          # Repository testing
│   ├── mongodb.md       # mongodb-memory-server patterns
│   └── postgres.md      # pg-mem patterns
│
├── kafka/               # NestJS Kafka microservices testing
│   └── kafka.md         # ClientKafka, @MessagePattern, @EventPattern handlers
│
└── redis/               # Redis cache testing
    └── redis.md         # Cache operations, health checks, graceful degradation

Quick Reference by Task

Write Unit Tests

  1. MANDATORY: Read references/common/rules.md - AAA pattern, naming, coverage
  2. Read references/common/assertions.md - Assertion best practices
  3. Read component-specific files:
    • Services: references/nestjs/services.md
    • Controllers: references/nestjs/controllers.md
    • Guards: references/nestjs/guards.md
    • Interceptors: references/nestjs/interceptors.md
    • Pipes/Filters: references/nestjs/pipes-filters.md

Setup Mocking

  1. Read `r
Полный SKILL.md на GitHub

Установить typescript-unit-testing в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

LICENSEreferences/common/assertions.mdreferences/common/detect-open-handles.mdreferences/common/examples.mdreferences/common/knowledge.mdreferences/common/performance-optimization.mdreferences/common/rules.mdreferences/kafka/kafka.mdreferences/mocking/deep-mocked.mdreferences/mocking/factories.mdreferences/mocking/jest-native.mdreferences/nestjs/controllers.mdreferences/nestjs/guards.mdreferences/nestjs/interceptors.mdreferences/nestjs/pipes-filters.mdreferences/nestjs/services.mdreferences/redis/redis.mdreferences/repository/mongodb.mdreferences/repository/postgres.mdworkflows/debugging/steps/step-01-init.mdworkflows/debugging/steps/step-01b-continue.mdworkflows/debugging/steps/step-02-classify-failure.mdworkflows/debugging/steps/step-03-analyze.mdworkflows/debugging/steps/step-04-implement-fix.mdworkflows/debugging/steps/step-05-verify-fix.mdworkflows/debugging/steps/step-06-document-resolution.mdworkflows/debugging/templates/output-template.mdworkflows/debugging/workflow.mdworkflows/optimizing/steps/step-01-init.mdworkflows/optimizing/steps/step-01b-continue.mdworkflows/optimizing/steps/step-02-identify-opportunities.mdworkflows/optimizing/steps/step-03-optimize-setup.mdworkflows/optimizing/steps/step-04-fix-open-handles.mdworkflows/optimizing/steps/step-05-optimize-async.mdworkflows/optimizing/steps/step-06-optimize-data.mdworkflows/optimizing/steps/step-07-optimize-organization.mdworkflows/optimizing/steps/step-08-measure-improvement.mdworkflows/optimizing/steps/step-09-document-optimizations.mdworkflows/optimizing/templates/output-template.mdworkflows/optimizing/workflow.md

FAQ

Что делает скилл typescript-unit-testing?

Unit testing for TypeScript/NestJS projects using Jest, @golevelup/ts-jest (DeepMocked/createMock), and in-memory databases, with AAA structure. Use whenever the user is working on `.spec.ts` files or asks to set up Jest, write/add tests for a service/usecase/controller/guard/interceptor/pipe/filter, mock dependencies, review test quality or coverage, run unit tests, debug failing or flaky tests, or optimize test performance and open handles.

Как установить скилл typescript-unit-testing?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл typescript-unit-testing запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить typescript-unit-testing с