pest-testing

Write and run Pest 4 tests for Laravel applications including browser and architecture tests.

Updated Mar 20, 2026
One-click install
npx skills add https://github.com/designbycode/uidesign --skill pest-testing-designbycode
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pest-testing
Source: https://github.com/designbycode/uidesign/tree/main/.junie/skills/pest-testing
Command: npx skills add https://github.com/designbycode/uidesign --skill pest-testing-designbycode

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing consistent, modern PHP tests in Laravel projects requires knowing Pest 4 syntax, conventions, and features like datasets, browser testing, and architecture rules, which developers often get wrong or mix with legacy PHPUnit patterns. ## Core Features & Use Cases - Pest Test Authoring: Create unit, feature, and browser tests using it()/expect() syntax, datasets, and Pest-specific mocking with proper conventions. - Browser & Smoke Testing: Run real-browser tests with visit/click/fill interactions, JavaScript error checks, and multi-page smoke tests. - Architecture Testing: Enforce code conventions with arch() rules such as controller suffix and inheritance constraints. - Use Case: After changing a password reset flow, ask the assistant to write a Pest browser test that visits the sign-in page, submits the reset form, and asserts the notification was sent. ## Quick Start Write a Pest feature test for the password reset flow and run it with php artisan test --compact --filter.

Frequently Asked Questions about pest-testing

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

FAQPage Schema
How do I write a Pest test in Laravel?

Create tests with php artisan make:test --pest {name} and use it()/expect() syntax, for example it('is true', function () { expect(true)->toBeTrue(); }). Place feature tests in tests/Feature and unit tests in tests/Unit.

How do I run a single Pest test in Laravel?

Run a filtered test with php artisan test --compact --filter=testName, or run a specific file with php artisan test --compact tests/Feature/ExampleTest.php. Use --compact for minimal output before finalizing.

Does Pest 4 support browser testing in Laravel?

Yes, Pest 4 browser tests live in tests/Browser and run in real browsers using visit(), click(), fill(), and assertNoJavaScriptErrors(). They support Laravel features like Event::fake(), model factories, and RefreshDatabase.

Why is Pest mock not working in my Laravel test?

The mock function must be imported before use with use function Pest\Laravel\mock;. Forgetting this import is a common pitfall that causes mocking to fail in Pest tests.

When should I use datasets in Pest tests?

Use datasets for repetitive tests such as validation rules, attaching data with ->with([...]) after the test definition. This avoids duplicating test logic for multiple input cases like email formats.