pest-testing

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

1|Updated Aug 4, 2026
One-click install
npx skills add https://github.com/LaravelDaily/nativephp-larapackagehunt --skill pest-testing-laraveldaily
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pest-testing
Source: https://github.com/LaravelDaily/nativephp-larapackagehunt/tree/main/.agents/skills/pest-testing
Command: npx skills add https://github.com/LaravelDaily/nativephp-larapackagehunt --skill pest-testing-laraveldaily

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing consistent, modern PHP tests in Laravel projects requires knowing Pest-specific syntax, conventions, and features. This Skill guides the creation, fixing, and refactoring of Pest tests so they follow project conventions and use Pest 5 capabilities correctly. ## Core Features & Use Cases - Test Authoring: Generate unit, feature, and browser tests using test()/it()/expect() syntax, datasets, mocking, and proper artisan make:test conventions. - Pest 5 Features: Apply Test Impact Analysis (--tia), time-balanced sharding, new validation expectations like toBeEmail(), and smoke testing across multiple pages. - Browser & Architecture Testing: Write real-browser tests with visit/click/fill interactions and enforce code conventions with arch() tests. - Use Case: After a code change breaks your suite, ask for help fixing the failing tests, then run only affected tests with ./vendor/bin/pest --parallel --tia to verify quickly. ## Quick Start Write a Pest feature test for my Laravel registration endpoint and run it with a filter to confirm it passes.

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 the test file with php artisan make:test --pest TestName, without prefixing Feature/ or Unit/ in the name. Write tests using test() or it() functions with expect() assertions, matching the convention used by existing tests in the same directory.

How do I run only tests affected by recent code changes?

Run ./vendor/bin/pest --parallel --tia to use Test Impact Analysis. Tia reruns only tests affected by recent changes and replays cached results for the rest, including covered lines and branches.

How do I convert PHPUnit tests to Pest?

Rewrite PHPUnit class-based tests using Pest's test() or it() functions with expect() assertions. Replace assertStatus(200) with specific assertions like assertSuccessful(), and use datasets for repetitive validation cases.

Does Pest support browser testing in Laravel?

Yes, Pest 5 browser tests live in tests/Browser and run in real browsers. Use visit() to load pages, then chain actions like click, fill, and assertNoJavaScriptErrors, with support for Laravel features like Event::fake() and RefreshDatabase.

Why does my Pest mock fail with an undefined function error?

The mock function must be imported before use with use function Pest\Laravel\mock; at the top of the test file. Without this import, PHP cannot resolve the namespaced Pest function.

When should I not use this Pest testing skill?

Do not use it for factories, seeders, migrations, controllers, models, or other non-test PHP code. It is scoped strictly to writing, fixing, and running tests in Laravel projects.