pest-testing

Write and refactor Pest PHP tests for Laravel projects.

1.5k|170|Updated Sep 25, 2024
One-click install
npx skills add https://github.com/relaticle/relaticle --skill pest-testing-relaticle
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pest-testing
Source: https://github.com/relaticle/relaticle/tree/main/.claude/skills/pest-testing
Command: npx skills add https://github.com/relaticle/relaticle --skill pest-testing-relaticle

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Pest testing in Laravel projects can be chaotic and hard to maintain; this skill provides structured guidance, patterns, and examples to streamline Pest-based tests.

Core Features & Use Cases

  • Clear Pest test conventions for unit, feature, and browser tests in Laravel.
  • Guidance on writing, refactoring, and debugging Pest tests, including datasets and mocking.
  • Templates and best practices for Livewire components and RefreshDatabase workflows.

Quick Start

Create or update Pest tests in your Laravel project by running php artisan test with Pest syntax.

Frequently Asked Questions about pest-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Pest PHP tests for a Laravel project?

To write Pest PHP tests in Laravel, use structured conventions and templates for unit, feature, and browser tests. This approach provides clear guidance on syntax, datasets, and testing directories like tests/Feature and tests/Unit.

Does Pest testing work with Livewire components in Laravel?

Yes, Pest testing works with Livewire components in Laravel. It provides specific templates and best practices to test Livewire components, ensuring reliable interactions and state management within your test suite.

What's the best way to structure Laravel feature tests using Pest?

The best way to structure Laravel feature tests using Pest is to align with test directories like tests/Feature and apply structured patterns. This includes using RefreshDatabase workflows and organizing datasets to improve test reliability and speed.

Can I use Pest 4 for browser testing in Laravel applications?

Yes, you can use Pest 4 for browser testing in Laravel applications. The testing conventions support tests/Browser directories, providing structured guidance and patterns to ensure your browser tests are reliable and maintainable.

How do I use datasets in Pest PHP tests?

To use datasets in Pest PHP tests, apply structured patterns that allow you to run the same test against multiple data inputs. This improves test coverage and speed by refactoring repetitive test cases into manageable data providers.

Why are my Pest tests in Laravel slow and hard to maintain?

Pest tests in Laravel become slow and hard to maintain when lacking structured guidance. By applying consistent conventions, using RefreshDatabase efficiently, and organizing tests into proper directories, you can improve both reliability and speed.