jest-nestjs-testing

Test NestJS services and endpoints with Jest, Supertest, and TypeORM.

3|Updated Jan 25, 2026
One-click install
npx skills add https://github.com/ai-enhanced-engineer/aiee-skills --skill jest-nestjs-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jest-nestjs-testing
Source: https://github.com/ai-enhanced-engineer/aiee-skills/tree/main/skills/jest-nestjs-testing
Command: npx skills add https://github.com/ai-enhanced-engineer/aiee-skills --skill jest-nestjs-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jest, supertest, typeorm, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the complexities of testing NestJS applications, particularly focusing on unit and end-to-end testing with Jest, while leveraging TypeORM and Supertest for robust test coverage.

Core Features & Use Cases

  • Unit Testing: Facilitates unit testing of service logic using Jest, Test.createTestingModule, and TypeORM for repository mocking.
  • End-to-End Testing: Supports end-to-end testing with INestApplication and supertest, ensuring real-world application behavior is validated.
  • Test Database Isolation: Provides strategies for test database isolation to avoid data leaks and maintain test integrity.
  • Authentication Testing: Includes support for testing authentication flows in end-to-end scenarios.
  • Use Case: A developer can use this Skill to create a comprehensive test suite for a NestJS application, ensuring that services, controllers, guards, and repositories all function as expected.

Quick Start

Use the jest-nestjs-testing skill to initialize a new test suite for your NestJS application by running the command: jest-nestjs-testing setup.

Frequently Asked Questions about jest-nestjs-testing

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

FAQPage Schema
How do I set up end-to-end testing for a NestJS application with Supertest?

Set up end-to-end testing for a NestJS application by initializing an INestApplication instance and routing HTTP requests through Supertest to validate real-world application behavior and authentication flows.

What is the best way to mock TypeORM repositories in NestJS unit tests?

Mock TypeORM repositories in NestJS unit tests by using Jest alongside Test.createTestingModule to isolate service logic and replace database dependencies with custom mock implementations.

How do I isolate my test database when running Jest tests in NestJS?

Isolate your test database when running Jest tests in NestJS by applying test database isolation strategies that prevent data leaks and maintain the integrity of your integration testing environment.

Can I test authentication flows in NestJS using Supertest?

You can test authentication flows in NestJS using Supertest by configuring end-to-end testing scenarios that validate guards and controllers against real HTTP requests and authentication mechanisms.

Does this testing approach support validating backend logic for controllers and guards?

This testing approach supports validating backend logic for controllers and guards by combining Jest unit tests with Supertest end-to-end tests to ensure all components function as expected.