create-e2e-test_skill

This skill generates an end-to-end test file template for a specified NestJS module, enabling quick controller testing setup.
  • TypeScript

481

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill mx-space/core --skill create-e2e-test

  • SKILL.md5.3 KB

Overview

This skill creates a ready-to-run end-to-end (E2E) test file for a specified NestJS module. It scaffolds a Vitest-based controller e2e-spec.ts file in the correct apps/core/test path, including mock data, model setup, and common CRUD test flows. Use it to speed up adding consistent E2E coverage for controllers.

How this skill works

Given a module name, the skill generates an E2E test file at apps/core/test/src/modules/<module-name>/<module-name>.controller.e2e-spec.ts. The template wires the controller, service, and model into a test app via createE2EApp, injects mock data in pourData, and provides tests for list, get, create, update, and delete endpoints. The template also includes database and redis mock helpers and notes about auth mocking and response shapes.

When to use it

  • Adding an end-to-end test for a new or existing controller module
  • Standardizing E2E test structure across modules
  • Bootstrapping tests when onboarding a new feature in the core app
  • Creating reproducible CRUD tests for API endpoints before deployment

Best practices

  • Populate mockData with realistic required fields used by your schema
  • Use pourData to seed only the records needed for tests and clean up in afterAll
  • Validate both success and failure cases (invalid id, invalid payload)
  • Rely on proxy.app.inject() to simulate HTTP requests through full request pipeline
  • Keep tests focused and deterministic; avoid external network calls

Example use cases

  • Generate tests for a posts controller to verify pagination, retrieval, create, update, and delete flows
  • Add E2E coverage for a user management module with auth-disabled tests for happy paths
  • Quickly scaffold tests for a new product or content module backed by Mongoose models
  • Create a baseline set of tests before refactoring controller or service logic

FAQ

The file is created at apps/core/test/src/modules/<module-name>/<module-name>.controller.e2e-spec.ts.

How are database and redis handled in tests?

createE2EApp integrates test helpers: dbHelper for Mongoose models and an automatic redis mock; pourData seeds test records and afterAll cleans them up.

How do I test unauthenticated scenarios?

By default @Auth() is mocked to treat requests as authenticated; switch to the real AuthGuard in a test to simulate unauthenticated flows.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational