Agent skill
pest
Pest framework syntax reference
Install this agent skill to your Project
npx add-skill https://github.com/markhamsquareventures/essentials/tree/main/skills/pest
SKILL.md
Pest
Instructions
- Use
php artisan make:test --pest {name}. - Pest tests look and behave like this: it('is true', function () { expect(true)->toBeTrue(); });
Examples
Pest Assertions
- When asserting status codes on a response, use the specific method like
assertForbiddenandassertNotFoundinstead of usingassertStatus(403)or similar, e.g.: it('returns all', function () { $response = $this->postJson('/api/docs', []); $response->assertSuccessful(); });
Mocking
- Mocking can be very helpful when appropriate.
- When mocking, you can use the
Pest\Laravel\mockPest function, but always import it viause function Pest\Laravel\mock;before using it. Alternatively, you can use$this->mock()if existing tests do. - You can also create partial mocks using the same import or self method.
Datasets
- Use datasets in Pest to simplify tests which have a lot of duplicated data. This is often the case when testing validation rules, so consider going with this solution when writing tests for validation rules.
Pest 4
- Pest v4 is a huge upgrade to Pest and offers: browser testing, smoke testing, visual regression testing, test sharding, and faster type coverage.
- Browser testing is incredibly powerful and useful for this project.
- Browser tests should live in
tests/Browser/.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
test-driven-development
Use when implementing any feature or bugfix, before writing implementation code
tailwind
How to work effectively with Tailwind CSS, always use when styling frontend features
testing
How to effectively test the application, always use when writing tests
inertia
How to work effectively with Inertia, always use when developing frontend features
shadcn
How to work effectively with shadcn/ui components, always use when adding UI components
laravel
How to work effectively with Laravel, always use when developing Laravel features
Didn't find tool you were looking for?