spatie avatar

Pest Testing

This one activates when you're writing or debugging Pest 4 tests in PHP projects. It pushes you toward idiomatic Pest patterns like using specific assertions (assertSuccessful instead of assertStatus(200)), datasets for repetitive validation tests, and proper browser test structure with assertNoJavascriptErrors. The skill includes examples for browser testing, smoke testing, visual regression, and architecture tests. It's opinionated about test organization and won't let you casually delete tests without approval, which is actually useful discipline. If you're doing TDD in Laravel or just need to verify functionality works, this keeps you from writing tests that look like PHPUnit with a Pest hat on.

skills.sh installs
729
GitHub stars
647
last updated
Aug 21, 2026

Install

$ npx -y skills add spatie/freek.dev --skill pest-testing --agent claude-code

Installs into .claude/skills of the current project.

Files

Pest Testing 4

When to Apply

Activate this skill when:

  • Creating new tests (unit, feature, or browser)
  • Modifying existing tests
  • Debugging test failures
  • Working with browser testing or smoke testing
  • Writing architecture tests or visual regression tests

Documentation

Use search-docs for detailed Pest 4 patterns and documentation.

Basic Usage

Creating Tests

All tests must be written using Pest. Use php artisan make:test --pest {name}.

Test Organization

  • Unit/Feature tests: tests/Feature and tests/Unit directories.
  • Browser tests: tests/Browser/ directory.
  • Do NOT remove tests without approval - these are core application code.

Basic Test Structure

it('is true', function () { expect(true)->toBeTrue(); });

Running Tests

  • Run minimal tests with filter before finalizing: php artisan test --compact --filter=testName.
  • Run all tests: php artisan test --compact.
  • Run file: php artisan test --compact tests/Feature/ExampleTest.php.

Assertions

Use specific assertions (assertSuccessful(), assertNotFound()) instead of assertStatus():

Sponsors

Details

Repository
github.com/spatie/freek.dev
Categories
Testing & QA, Documentation, Debugging, Automation & Workflows, PHP & Laravel
First seen
Jun 3, 2026

More from spatie/freek.dev

All 2
1alirezarezvani avatarplaywright-proalirezarezvani/claude-skillsProduction-grade Playwright testing toolkit. Use when the user mentions Playwright tests, end-to-end testing, browser automation, fixing flaky tests, test migra687skills.sh installs
2aj-geddes avatarunit-testing-frameworkaj-geddes/useful-ai-promptsWrite comprehensive unit tests with high coverage using testing frameworks like Jest, pytest, JUnit, or RSpec. Use when writing tests for functions, classes, co622skills.sh installs
3wshaddix avatardotnet-testing-strategywshaddix/dotnet-skillsDeciding how to test .NET code. Unit vs integration vs E2E decision tree, test doubles.619skills.sh installs
4lambdatest avatarplaywright-skilllambdatest/agent-skillsGenerates production-grade Playwright automation scripts and E2E tests in TypeScript, JavaScript, Python, Java, or C#. Supports local execution and TestMu AI cl554skills.sh installs
5davila7 avatarplaywright-skilldavila7/claude-code-templatesComplete browser automation with Playwright. Auto-detects dev servers, writes clean test scripts to /tmp. Test pages, fill forms, take screenshots, check respon525skills.sh installs
6aj-geddes avatarfrontend-testingaj-geddes/useful-ai-promptsImplement comprehensive frontend testing using Jest, Vitest, React Testing Library, and Cypress. Use when building robust test suites for UI and integration tes514skills.sh installs