pest-testing

Writes and maintains Pest 4 tests for Laravel applications including browser and architecture tests.

Updated Jul 18, 2026
One-click install
npx skills add https://github.com/daviddatuX25/Serbizyu-2.0 --skill pest-testing-daviddatux25
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pest-testing
Source: https://github.com/daviddatuX25/Serbizyu-2.0/tree/main/.cursor/skills/pest-testing
Command: npx skills add https://github.com/daviddatuX25/Serbizyu-2.0 --skill pest-testing-daviddatux25

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing consistent, idiomatic Pest tests in Laravel projects is error-prone: developers misuse artisan generators, pick weak assertions, forget dataset patterns, or skip browser-level checks. This Skill provides the conventions and syntax needed to write, fix, and refactor Pest 4 tests correctly. ## Core Features & Use Cases - Test Authoring Conventions: Correct make:test --pest usage, test()/it() matching project style, and proper placement in tests/Feature, tests/Unit, and tests/Browser. - Pest 4 Feature Coverage: Datasets, mocking via Pest\Laravel\mock, specific response assertions, browser testing with visit/click/fill, smoke testing for JavaScript errors, visual regression, sharding, and architecture tests with arch(). - Use Case: After a code change breaks your suite, ask the AI to fix the failing tests — it will run filtered tests with --compact --filter, apply specific assertions like assertSuccessful() instead of assertStatus(200), and add datasets for repetitive validation cases. ## Quick Start Write a Pest feature test for the registration endpoint and run it with a filtered artisan test command.

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 `vendor/bin/sail artisan make:test --pest {name}` where the name excludes the suite prefix. For example, `make:test --pest SomeControllerTest` creates tests/Feature/SomeControllerTest.php, and adding `--unit` places it in tests/Unit.

How do I write browser tests with Pest 4?▼

Pest 4 browser tests live in tests/Browser and use the `visit()` function to load pages in real browsers. Chain actions like click, fill, and assertSee, and include `assertNoJavaScriptErrors()` to catch frontend errors during the test.

Should I use test() or it() in Pest?▼

Pest supports both functions, so check existing test files in the same directory and match the project convention. Use `test()` if existing tests use it, otherwise use `it()` for consistency across the suite.

Why does Pest mocking 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, calling mock() raises an undefined function error.

When should I use datasets in Pest tests?▼

Use datasets for repetitive tests such as validation rules where the same logic runs against multiple inputs. Attach them with `->with([...])` using named keys so failures clearly identify which input case broke.