Index of every page on this site: llms.txt
All skills
bmad-labs avatar

/typescript-e2e-testing

@c636fe5
by bmad-labsbmad-labs/skills19 stars
4
Run it yourself

E2E and integration testing for TypeScript/NestJS projects using Jest, supertest, and real infrastructure via Docker (Kafka, PostgreSQL, MongoDB, Redis) with the Given-When-Then pattern. Use whenever the user is working on `.e2e-spec.ts` files or anything under `test/e2e/`, or asks to set up, write, review, run, debug, or optimize E2E or integration tests — including flaky tests, docker-compose for tests, Kafka/Redpanda consumers, test isolation, or GWT compliance.

Use this Skill: https://skilld.dev/gh/bmad-labs/skills/typescript-e2e-testing

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

workflowsrunningworkflow.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Running E2E Test Workflow

Execute E2E tests reliably with proper infrastructure setup, environment configuration, and result interpretation.

When to Use

  • Running E2E tests
  • Starting/stopping Docker infrastructure for testing
  • Analyzing E2E test results
  • Verifying Docker services are healthy
  • Interpreting test output and failures

Prerequisites

Have E2E tests written and Docker infrastructure configured.

Fast Path

For a plain "run the tests" request, skip the run log and the [C] gates: set the session ID (export E2E_SESSION=$(date +%s)-$$), confirm the Docker infrastructure is up (step 2's checks), run the requested scope with output redirected to /tmp/e2e-${E2E_SESSION}-output.log, read the summary and failures from that file, and summarise the result in chat. Use the full step flow below only when the user asks for a run log or wants failures worked through.

Step-File Architecture

This workflow uses a step-file architecture for context-safe execution:

  • Each step is a separate file loaded sequentially
  • Progress is tracked via stepsCompleted in the output document's YAML frontmatter
  • If context is compacted mid-workflow, step-01 detects existing output and resumes from the last completed step via step-01b

Steps

Step File Description
1 step-01-init.md Initialize workflow, set output path, detect continuation
1b step-01b-continue.md Resume from last completed step
2 step-02-pre-run.md Verify infrastructure is ready
3 step-03-determine-scope.md Determine which tests to run
4 step-04-execute.md Execute tests with appropriate configuration
5 step-05-interpret-results.md Analyze test results
6 step-06-handle-failures.md Systematically address failures (if any)
7 step-07-verify-fixes.md Verify fixes are stable
8 step-08-cleanup.md Post-run cleanup, mark complete

Rules

  1. Load one step at a time - Read the step file, execute it, then load the next
  2. Update frontmatter after each step - Add the step number to stepsCompleted
  3. Wait for user confirmation - Present findings and wait for [C] before proceeding (skipped on the fast path)
  4. Load reference files - Each step specifies which reference files to load before action

Mandatory Execution Rules

  • ALWAYS verify infrastructure is running before tests
  • ALWAYS run tests sequentially (maxWorkers: 1)
  • NEVER run full suite when individual tests are failing
  • NEVER run full suite repeatedly while debugging - Fix one test at a time
  • ALWAYS review logs when tests fail
  • ALWAYS output test results to temp files - Avoids context bloat from verbose output

Context Efficiency: Temp File Output

IMPORTANT: Redirect output to temp files only (NO console output). Use unique session ID to prevent conflicts.

# Initialize session (once at start of E2E work)
export E2E_SESSION=$(date +%s)-$$

# Standard pattern for all test runs
npm run test:e2e > /tmp/e2e-${E2E_SESSION}-output.log 2>&1

# Then read only what's needed
tail -50 /tmp/e2e-${E2E_SESSION}-output.log

# Cleanup when done
rm -f /tmp/e2e-${E2E_SESSION}-*.log /tmp/e2e-${E2E_SESSION}-*.md

Quick Command Reference

npm run docker:e2e                                                                    # Start infrastructure
npm run test:e2e > /tmp/e2e-${E2E_SESSION}-output.log 2>&1 && tail -50 /tmp/e2e-${E2E_SESSION}-output.log  # Run all
npm run test:e2e -- test/e2e/{file}.e2e-spec.ts > /tmp/e2e-${E2E_SESSION}-output.log 2>&1 && tail -50 /tmp/e2e-${E2E_SESSION}-output.log  # Run file
npm run test:e2e -- -t "{test name}" > /tmp/e2e-${E2E_SESSION}-output.log 2>&1 && tail -50 /tmp/e2e-${E2E_SESSION}-output.log  # Run test
grep -B 2 -A 15 "FAIL\|✕" /tmp/e2e-${E2E_SESSION}-output.log                        # Get failures
docker compose -f docker-compose.e2e.yml down                                         # Stop infrastructure

Common Issues and Solutions

Issue Cause Solution
Connection refused Docker not running npm run docker:e2e
Test timeout Slow infrastructure Increase timeout or check service health
Flaky tests Race condition Add wait in beforeEach, use polling
Port conflict Another service Change E2E ports in docker-compose.e2e.yml
Memory issues Too many containers Restart Docker, increase memory

Begin

Load steps/step-01-init.md to start.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 alert4d5 checks · Risk SAFE
  • Gen Agent Trust Hub4d

    The skill is a comprehensive toolkit for E2E testing in TypeScript/NestJS environments. It provides structured workflows for setup, writing, and debugging tests using Docker-based infrastructure. No malicious patterns or security risks were identified.

  • Socket4d

    No alerts

  • Snyk4d

    Risk: LOW · No issues

  • Runlayer8mo

    30/103 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at c636fe5. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated last week
  • TypeScript
  • jest
  • nestjs
  • e2e-testing
  • supertest
  • docker
  • kafka
  • postgres
  • mongodb
  • redis
  • integration-testing
  • gwt-pattern

README badge

README badge for bmad-labs/skills

Writes E2E and integration tests for NestJS projects using Jest and supertest against real Docker infrastructure (Kafka, PostgreSQL, MongoDB, Redis) following the Given-When-Then pattern. Covers test setup, writing, review, debugging, and optimization workflows with technology-specific helpers and isolation strategies for each service.

Generated from the current SKILL.md.

Does this skill work with NestJS only?
The skill is built for NestJS projects using Jest and supertest, but the patterns and workflows apply to any TypeScript backend with HTTP endpoints. Technology-specific helpers exist for Kafka, PostgreSQL, MongoDB, and Redis.
Do I need Docker running to use this skill?
Yes. The skill assumes real infrastructure via Docker (Kafka, PostgreSQL, MongoDB, Redis). Tests execute against actual services, not mocks.
What if my E2E tests are flaky or failing?
The Debugging E2E Test workflow provides a systematic protocol: fix one test at a time using isolated test runs, verify with 3-5 consecutive runs before moving to the next failure, then run the full suite only once all tests pass individually.
Does this skill cover GraphQL or gRPC testing?
Yes. The API testing reference includes examples for REST, GraphQL, and gRPC, plus external API mocking with MSW and Nock.
What is the Given-When-Then pattern and is it mandatory?
GWT is the mandatory test structure: Given describes setup state, When describes the action under test, Then describes expected outcomes. All E2E tests in this skill must follow this pattern.

Generated from the current SKILL.md. These answers refresh after source changes.