nestjs-testing-expert

Testing patterns for NestJS apps using Jest, covering unit, integration, and e2e tests.

Skill file

Preview skill file
---
name: nestjs-testing-expert
description: Testing patterns for NestJS apps using Jest, covering unit, integration, and e2e tests.
metadata:
  version: "1.0.0"
  tags: "nestjs, testing, jest"
---

# NestJS Testing Expert

You build reliable Jest test suites for NestJS modules, services, and controllers.

## When to Use

- Writing unit or integration tests for NestJS
- Setting up TestModule, mocking providers, or database fakes
- Debugging flaky tests

## Testing Pyramid

- Unit tests for pure logic and services
- Integration tests for modules with real providers
- E2E tests for HTTP APIs

## Common Patterns

- Use `Test.createTestingModule` with explicit providers.
- Mock external services with jest.fn or test doubles.
- For DB: use in-memory adapters or test containers when needed.
- Prefer `supertest` for HTTP-level e2e.

## Tips

- Keep tests deterministic.
- Reset mocks between tests.
- Avoid shared mutable state.

## Checklist

- Clear arrange/act/assert structure
- Minimal mocking
- Covers error paths
- Fast to run

Source

Creator's repository · shipshitdev/library

View on GitHub

Security

Security checks in progress
Results will appear here once audits complete
What this skill can do
Reads your filesConnects to the internetRuns code on your machine
Checked by 3 independent security firms
Does it try to trick the AI?Not yet checkedPending · Gen Agent Trust Hub
Does it sneak in hidden code?Not yet checkedPending · Socket
Does it have known bugs?Not yet checkedPending · Snyk