pest-testing

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

Updated Jun 24, 2026
One-click install
npx skills add https://github.com/stacktracelabs/laravel-vue-starter-kit --skill pest-testing-stacktracelabs
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pest-testing
Source: https://github.com/stacktracelabs/laravel-vue-starter-kit/tree/main/.agents/skills/pest-testing
Command: npx skills add https://github.com/stacktracelabs/laravel-vue-starter-kit --skill pest-testing-stacktracelabs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing consistent, correct tests in Laravel projects requires knowing Pest-specific syntax, conventions, and tooling. This Skill guides AI agents to generate, fix, and refactor Pest 4 tests that follow Laravel best practices, avoiding common mistakes like wrong artisan commands or weak assertions. ## Core Features & Use Cases - Test Creation & Conventions: Generate unit, feature, and browser tests with correct make:test --pest usage, matching existing project conventions for test() vs it(). - Pest 4 Capabilities: Covers datasets, mocking, browser testing (visit/click/fill), smoke testing for JavaScript errors, visual regression, test sharding, and architecture tests with arch(). - Assertion Best Practices: Enforces specific assertions like assertSuccessful() instead of assertStatus(200) and proper RefreshDatabase usage. - Use Case: After changing a controller, ask the agent to fix the broken feature tests, add dataset-driven validation tests, and run a filtered test suite to confirm everything passes. ## Quick Start Ask the agent to write a Pest feature test for your registration endpoint 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 create a Pest test in Laravel?▼

Run php artisan make:test --pest TestName to generate a feature test, or add --unit for a unit test. Do not prefix the name with Feature/ or Unit/, as that creates a duplicated directory like tests/Feature/Feature/.

How do I run Pest tests in a Laravel project?▼

Run php artisan test --compact to execute the full suite, add --filter=testName to run a single test, or pass a file path like tests/Feature/ExampleTest.php to run one file.

What is the difference between test() and it() in Pest?▼

Both functions define tests identically; it() simply reads more naturally for behavior descriptions. Check existing test files in the same directory and match whichever convention the project already uses.

Does Pest 4 support browser testing in Laravel?▼

Yes, Pest 4 includes browser testing where tests live in tests/Browser/ and run in real browsers. You can visit pages, click, fill forms, assert no JavaScript errors, switch devices and color schemes, and take screenshots.

Why should I use assertSuccessful instead of assertStatus(200)?▼

Specific assertions like assertSuccessful(), assertNotFound(), and assertForbidden() express intent more clearly than numeric status checks. They make tests more readable and produce clearer failure messages.

When should I not use this Pest testing skill?▼

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