Pest 5: TIA Engine, Agent Plugin &amp; Evals Explained | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com) [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles  ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

  [ home ](https://msaied.com)    [ articles ](https://msaied.com/articles)    Pest 5 Released: Test Impact Analysis, Agent Verification, and Evals        On this page       1. [  Pest 5 Is Here ](#pest-5-is-here)
2. [  Test Impact Analysis With the TIA Engine ](#test-impact-analysis-with-the-tia-engine)
3. [  Verifying AI Agent Changes With the Agent Plugin ](#verifying-ai-agent-changes-with-the-agent-plugin)
4. [  Testing LLM Output With Evals ](#testing-llm-output-with-evals)
5. [  PHPStan and Rector Plugins ](#phpstan-and-rector-plugins)
6. [  New Expectations ](#new-expectations)
7. [  Upgrading to Pest 5 ](#upgrading-to-pest-5)
8. [  Key Takeaways ](#key-takeaways)

  ![Pest 5 Released: Test Impact Analysis, Agent Verification, and Evals](https://cdn.msaied.com/493/a1d6434093b945e8a3291eb09c09e768.png)

 [  Laravel ](https://msaied.com/articles?category=laravel) [  PHP ](https://msaied.com/articles?category=php)  #Pest PHP   #Testing   #PHP 8.4   #PHPUnit   #AI   #Laravel  

 Pest 5 Released: Test Impact Analysis, Agent Verification, and Evals 
======================================================================

     31 Jul 2026      4 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

1. [  01   Pest 5 Is Here  ](#pest-5-is-here)
2. [  02   Test Impact Analysis With the TIA Engine  ](#test-impact-analysis-with-the-tia-engine)
3. [  03   Verifying AI Agent Changes With the Agent Plugin  ](#verifying-ai-agent-changes-with-the-agent-plugin)
4. [  04   Testing LLM Output With Evals  ](#testing-llm-output-with-evals)
5. [  05   PHPStan and Rector Plugins  ](#phpstan-and-rector-plugins)
6. [  06   New Expectations  ](#new-expectations)
7. [  07   Upgrading to Pest 5  ](#upgrading-to-pest-5)
8. [  08   Key Takeaways  ](#key-takeaways)

 Pest 5 Is Here
--------------

Nuno Maduro announced Pest v5 on stage at Laracon US 2026 in Boston and tagged `v5.0.0` during the conference. The release ships a new TIA engine, five first-party plugins, eight new expectations, and bumps the baseline to PHP 8.4 and PHPUnit 13.

Test Impact Analysis With the TIA Engine
----------------------------------------

TIA (Test Impact Analysis) is the headline feature. On the first run Pest records which tests touch which files. Every subsequent run executes only the tests affected by your changes and replays cached results for everything else — without sacrificing coverage accuracy.

```bash
./vendor/bin/pest --parallel --tia

```

A typical summary looks like this:

```yaml
Tests:    774 passed (2658 assertions, 7 affected, 2 uncached, 765 replayed)
Duration: 3.92s

```

The dependency graph goes beyond PHP files. Change a migration and Pest re-runs only tests that queried that table. Edit a Blade template and it re-runs the tests that rendered it. It understands Laravel, Symfony, Livewire, Inertia, and Vite module graphs automatically — nothing to configure.

Taylor Otwell reported that Laravel Cloud's suite of 19,000+ tests dropped from 3 minutes to 5 seconds after enabling TIA.

> **Note:** TIA needs PCOV or Xdebug to record its baseline. Teams can have CI record the baseline once per merge to `main` and share it with everyone else.

Verifying AI Agent Changes With the Agent Plugin
------------------------------------------------

The Agent plugin gives coding agents a way to confirm their changes actually work inside your real test suite:

```bash
composer require pestphp/pest-plugin-agent --dev

```

```bash
./vendor/bin/pest --agent='$user = \App\Models\User::factory()->create(); $this->actingAs($user)->get("/dashboard")->assertOk();'

```

Each snippet runs as an isolated test with factories, `RefreshDatabase`, and Laravel fakes available. This is designed for quick feedback during development, not as a replacement for committed regression tests.

Testing LLM Output With Evals
-----------------------------

The Evals plugin scores LLM output quality through the familiar `expect()` API:

```bash
composer require pestphp/pest-plugin-evals --dev

```

```php
it('answers capital city questions correctly', function (): void {
    expect(CapitalCityAgent::class)
        ->prompt('What is the capital of France?')
        ->toContain('Paris')            // deterministic check
        ->toBeRelevant()                // LLM-as-judge scorer
        ->toBeSimilar('Paris, France'); // semantic similarity
});

```

Evals are skipped on a normal run and only execute when you pass `--evals`. Scored expectations accept a threshold between 0.0 and 1.0 (default 0.7). Available scorers include `toBeRelevant()`, `toBeSafe()`, `toBeFactual()`, `toBeSimilar()`, `toPassJudge()`, `toHaveToolCalls()`, and `toFollowTrajectory()`.

PHPStan and Rector Plugins
--------------------------

**PHPStan** — The new first-party plugin teaches PHPStan about `it()`, `test()`, `expect()`, and `$this` inside test closures. Types flow through expectation chains, and it catches impossible expectations like `expect(10)->toStartWith('1')`.

```bash
composer require pestphp/pest-plugin-phpstan --dev

```

**Rector** — Ships 60 rules that rewrite raw PHP assertions as Pest matchers and handle major version upgrades.

```php
use Pest\Rector\Set\PestSetList;

return RectorConfig::configure()
    ->withPaths([__DIR__ . '/tests'])
    ->withSets([PestSetList::CODING_STYLE]);

```

New Expectations
----------------

Eight new matchers cover common format checks:

```php
expect('nuno@pestphp.com')->toBeEmail();
expect('01ARZ3NDEKTSV4RRFFQ69G5FAV')->toBeUlid();
expect('192.168.1.1')->toBeIpAddress();
expect('00:1a:2b:3c:4d:5e')->toBeMacAddress();

```

Also available: `toBeHostname()`, `toBeDomain()`, `toBeBase64()`, and `toBeHexadecimal()`.

Upgrading to Pest 5
-------------------

Pest 5 requires PHP 8.4 and PHPUnit 13. For most suites the upgrade is a one-line change in `composer.json`:

```json
"pestphp/pest": "^5.0"

```

The Pest team documents no API-level breaking changes beyond the version bumps. Review the PHPUnit 13 changelog for anything that may affect your suite.

Key Takeaways
-------------

- **TIA engine** runs only affected tests and replays the rest from cache, preserving coverage accuracy
- **Agent plugin** lets AI coding agents verify changes inside a real feature-test environment
- **Evals plugin** scores LLM output with deterministic and AI-powered checks via `expect()`
- **PHPStan plugin** adds full type inference for Pest's DSL — a long-requested community feature
- **Rector plugin** ships 60 rules for coding style and version upgrades
- **PHP 8.4 and PHPUnit 13** are now required

---

*Source: [Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals — Laravel News](https://laravel-news.com/pest-5)*

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fmsaied.com%2Farticles%2Fpest-5-released-test-impact-analysis-agent-verification-and-evals&text=Pest+5+Released%3A+Test+Impact+Analysis%2C+Agent+Verification%2C+and+Evals) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fmsaied.com%2Farticles%2Fpest-5-released-test-impact-analysis-agent-verification-and-evals) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  Does the TIA engine skip tests or just replay cached results?        It replays cached results, which is different from skipping. Each cached result stores everything the test produced — including exact lines and branches covered — so --coverage reports and --min thresholds behave as though the full suite ran. 

      Q02  Do I need a coverage driver to use the TIA engine?        Yes. TIA needs PCOV or Xdebug installed to record its baseline on the first run. After that, subsequent runs use the recorded dependency graph to determine which tests to re-execute. 

      Q03  Are Evals tests run on every normal Pest invocation?        No. Evals are skipped by default and make no API calls unless you explicitly pass the --evals flag when running Pest. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://msaied.com/articles) 

 [ ![Job Batching, Chaining, and Rate-Limited Middleware in Laravel Queues](https://cdn.msaied.com/489/89d47dc6b618d5435f9d7f333b75e922.png) laravel queues jobs 

### Job Batching, Chaining, and Rate-Limited Middleware in Laravel Queues

Go beyond basic dispatch: learn how to compose Laravel job batches with callbacks, chain dependent jobs safely...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 30 Jul 2026     4 min read  

  Read    

 ](https://msaied.com/articles/job-batching-chaining-and-rate-limited-middleware-in-laravel-queues-3) [ ![Laravel Observers vs. Model Events: Choosing the Right Hook for Domain Side-Effects](https://cdn.msaied.com/488/451564d0a43aa33809619fa299027222.png) laravel eloquent domain-events 

### Laravel Observers vs. Model Events: Choosing the Right Hook for Domain Side-Effects

Model events and observers look similar but behave differently under bulk operations, transactions, and test i...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 30 Jul 2026     4 min read  

  Read    

 ](https://msaied.com/articles/laravel-observers-vs-model-events-choosing-the-right-hook-for-domain-side-effects) [ ![Practical RAG in Laravel: pgvector, Embeddings, and Retrieval Pipelines](https://cdn.msaied.com/487/2db17c4f7927d4a229a4786c03e7b67b.png) laravel ai pgvector 

### Practical RAG in Laravel: pgvector, Embeddings, and Retrieval Pipelines

Build a production-ready retrieval-augmented generation pipeline in Laravel using pgvector, OpenAI embeddings,...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 30 Jul 2026     4 min read  

  Read    

 ](https://msaied.com/articles/practical-rag-in-laravel-pgvector-embeddings-and-retrieval-pipelines-2) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

Explore

- [Home](https://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [Contact](https://msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
