Laravel Cloud is here! Zero-config managed infrastructure for Laravel apps. Deploy now.

Everything We Know about Pest 3

Published on by

Everything We Know about Pest 3 image

Nuno Maduro was the opening speaker at Laracon US 2024 on Tuesday, unveiling impressive new features for the upcoming Pest v3.0. Pest continues to grow in popularity, being downloaded over 18 million times and is the default testing framework in Laravel as of V11.

Pest v3 takes another important leap forward with three impressive features coming to Pest 3:

  • Task management
  • Architecture Presets
  • Mutation Testing

Let's look at each of these features shared at Laracon US in more detail:

Task Management

Task management lets you track things like assignee, issue number, pull request number, and notes, directly on a test. Tracking tasks allows you to keep a history of work that will always be availabe in your test:

test('some test 1', function () {
// ...
})->todo(assignee: 'paulredmond', issue: 13);
 
it('returns a successful response', function () {
$response = $this->get('/');
 
$response->assertStatus(200);
})->todo(
assignee:'paulredmond',
issue:11,
pr:1,
note:'Need to assert the response body.'
);
 
// Eric is a closer ☕️
test('drives always go in the fairway', function () {
// ...
})->done(assignee: 'ericlbarnes', issue: 13);

From the command line, you can filter tests by assignee or issue:

$ pest --issue=11
$ pest --assignee=paulredmond --pr=1
$ pest --assignee=ericlbarnes
$ pest --issue=13
$ pest --notes # returns tests with notes

Architecture Presets

Architecture presets are a way to quickly use the same architecture rules across multiple projects, and leverage popular presets like rules for Laravel, PHP, a strict PHP preset, or a relaxed preset. These will create more consistency in your code because they'll prevent you from doing things like leaving debug functions like phpinfo(), dd(), etc.

You can use these presets using the arch()->preset() method:

// Ensures PHP functions like die(), phpinfo(), etc. are not used
arch()->preset()->php();
 
// Ensures functions like eval(), md5(), etc. are not used.
arch()->preset()->security();
 
// Preset to validate things like resourceful controller methods,
// enum organization, controller files have a `Controller` suffix, etc.
arch()->preset()->laravel();
 
// Preset to ensure classes are final, strict typing, etc.
arch()->preset()->strict();
 
// Preset to ensure strict types are not used, no final, no private methods.
arch()->preset()->relaxed();

Presets speed up development because most rules you'd expect are already defined for you. Here's an example of the security preset failing because of the use of md5():

Here's an example of using the Strict preset, demonstrating a class that is not using the final keyword:

Mutation Testing

When mutation testing ships with Pest v3, it's going to blow your mind. Mark my words, when you run mutation tests on your codebase, this feature is going to make you cry, and then you won't be able to live without it.

Even if your test suite reports 100% coverage, mutation testing will help you find gaps in your tests. It does so by removing code from your implementation, swapping logic around, and poking holes in your code to try to make your tests fail.

Backwards Compatibility

Near the end of his talk, Nuno mentioned that Pest 2 users will be able to upgrade without any backward compatibility breaks. Users should be able to update the package to require v3 and update composer dependencies. This is huge because fixing compatibility breaks in your testing tool can be painful, especially if you have a lot of tests.

The future of Pest is bright with productive tools that level up your testing through mutations, make your application architecture more consistent, and help keep track of assignees and issues directly in your tests.

Which feature are you most excited about? Let us know on your favorite social media app!

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Filed in:
Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Laravel Code Review

Get expert guidance in a few days with a Laravel code review

Visit Laravel Code Review
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
SerpApi logo

SerpApi

Access real-time search engine results through a simple API—no more scraping headaches! Use it for AI applications, SEO tools, product research, travel information, and more

SerpApi
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing

The latest

View all →
Larapanda: A Type-Safe Lightpanda Browser SDK for Laravel image

Larapanda: A Type-Safe Lightpanda Browser SDK for Laravel

Read article
Generate HTML Password Rules Attribute in Laravel 13.9.0 image

Generate HTML Password Rules Attribute in Laravel 13.9.0

Read article
DHH Joins Laravel Live Denmark 2026 for Fireside Chat with Taylor Otwell image

DHH Joins Laravel Live Denmark 2026 for Fireside Chat with Taylor Otwell

Read article
Model-Based Scheduling for Laravel with Cadence image

Model-Based Scheduling for Laravel with Cadence

Read article
Laravel's AI SDK adds sub-agents image

Laravel's AI SDK adds sub-agents

Read article
Laravel Introduces First-Party Passkey Authentication Support image

Laravel Introduces First-Party Passkey Authentication Support

Read article