mcpField
T
tdd-with-pest

tdd-with-pest

github.com/dev-toolingsTesting & quality22770 installsUpdated 3w ago
Repository

About tdd-with-pest

A testing skill for Symfony projects using Pest v4 and PHP 8.3+. It guides RED-GREEN-REFACTOR tests, Symfony test bindings, and migration from PHPUnit syntax.

Key features

  1. 01RED-GREEN-REFACTOR workflow
  2. 02Symfony kernel and HTTP tests
  3. 03PHPUnit-to-Pest conversion guidance
  4. 04Parallel and coverage test gates

Use cases

  1. 01Developing a feature test-first
  2. 02Reproducing a bug before a fix
  3. 03Testing Symfony HTTP behavior
  4. 04Migrating PHPUnit tests to Pest

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/dev-toolings/superpowers-symfony --skill tdd-with-pest

After installing, type/tdd-with-pestin Claude Code to confirm it loaded.

Bundled filesreference.md

Details

From the project README

Tdd With Pest (Symfony)

Use when

  • Driving a feature with RED-GREEN-REFACTOR in a project that runs Pest v4 (PHP 8.3+).
  • Writing it() and expect() tests that need the Symfony kernel or an HTTP client.
  • Converting existing PHPUnit class tests to Pest syntax with pest-plugin-drift.
  • Adding a bug-reproducing test to a Pest suite before the fix.

Default workflow

  1. Confirm PHP 8.3+ and Pest v4, then generate tests/Pest.php with ./vendor/bin/pest --init.
  2. Bind the bridge classes in tests/Pest.php: uses(KernelTestCase::class, Factories::class, ResetDatabase::class)->in('Integration') and uses(WebTestCase::class, ...)->in('Functional').
  3. RED: write an it() test with Foundry v2 factories, run ./vendor/bin/pest --filter and check it fails for the right reason.
  4. GREEN: write the minimal code, then REFACTOR and re-run ./vendor/bin/pest.
  5. Gate the suite with --parallel and --coverage --min=80.

Guardrails

  • There is no official Symfony Pest plugin: never reference pestphp/pest-plugin-symfony, bind KernelTestCase or WebTestCase through uses().
  • Foundry v2 factories return real objects: no ->object() call.
  • Pest test files are anonymous, so use the Factories and ResetDatabase traits rather than the #[ResetDatabase] attribute.
  • Chain related checks with expect()->and(); keep one concept per test.

Progressive disclosure

  • Use this file for execution posture and risk controls.
  • Open references when deep implementation details are needed.

Output contract

  • The failing ./vendor/bin/pest output (RED), then the passing run.
  • tests/Pest.php bindings added or changed.
  • Test files changed and the commands executed.

References

  • reference.md

Comments

Markdown supported