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

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

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

  [ home ](https://www.msaied.com)    [ articles ](https://www.msaied.com/articles)    Pest 5 Released: Test Impact Analysis, Agent Verification, and Evals        On this page       1. [  What's New at a Glance ](#whats-new-at-a-glance)
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. [  Upgrading to Pest 5 ](#upgrading-to-pest-5)
7. [  Key Takeaways ](#key-takeaways)

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

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

 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   What's New at a Glance  ](#whats-new-at-a-glance)
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   Upgrading to Pest 5  ](#upgrading-to-pest-5)
7. [  07   Key Takeaways  ](#key-takeaways)

 Nuno Maduro announced **Pest v5** on stage at Laracon US 2026 in Boston and tagged `v5.0.0` during the conference. The headline feature is the TIA (Test Impact Analysis) engine, which slashed Laravel Cloud's 19,000-test suite from 3 minutes down to 5 seconds. The release also bundles first-party plugins for AI agents, LLM evaluation, PHPStan, and Rector.

What's New at a Glance
----------------------

- **TIA Engine** — re-runs only affected tests; replays cached results for the rest
- **Agent plugin** — gives AI coding agents a single command to verify changes inside a real test suite
- **Evals plugin** — scores LLM output with deterministic checks and AI-powered scorers
- **PHPStan plugin** — teaches PHPStan about `it()`, `test()`, `expect()`, and `$this` in test closures
- **Rector plugin** — 60 rules to rewrite assertions as Pest matchers and handle major version upgrades
- **New expectations** for emails, ULIDs, IP addresses, MAC addresses, and more
- **PHP 8.4 and PHPUnit 13** as the new baseline

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

The TIA engine records which tests touch which files on the first run, then executes only the tests affected by your latest changes and replays cached results for everything else.

```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

```

Cached results preserve coverage data, so `--coverage` reports and `--min` thresholds behave as if the full suite ran. The dependency graph understands migrations, Blade templates, Inertia/Vite module graphs, and Livewire components — no configuration needed. Pest also normalizes files before hashing them, so a Pint formatting pass or a comment edit produces an identical hash and runs nothing.

> **Note:** The TIA engine requires PCOV or Xdebug to record its baseline. CI baseline sharing requires an authenticated GitHub CLI and only works on GitHub.

Configure TIA behaviour in `tests/Pest.php`:

```php
pest()->tia()
    ->always()
    ->locally()
    ->baselined()
    ->filtered();

```

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, complete with factories, `RefreshDatabase`, and Laravel fakes:

```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 named "verify". 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 using 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
        ->toBeRelevant()              // LLM-as-judge
        ->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
--------------------------

The **PHPStan plugin** reads your `Pest.php` configuration to resolve `$this` types inside test closures, narrows types through expectation chains, and catches impossible expectations like `expect(10)->toStartWith('1')`.

The **Rector plugin** ships 60 rules across coding style and version upgrade sets. A quick example of what it rewrites:

```php
// Before
expect(count($array))->toBe(5);
expect(array_key_exists('id', $array))->toBeTrue();

// After
expect($array)->toHaveCount(5)
    ->toHaveKey('id');

```

Preview changes safely with `vendor/bin/rector process --dry-run`.

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

Pest 5 requires PHP 8.4 and PHPUnit 13. The Pest upgrade guide documents no API-level breaking changes beyond the version bumps. For most projects it is a one-line change:

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

```

Update any Pest-maintained plugins to `^5.0` at the same time.

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

- The TIA engine can reduce large suite runtimes dramatically by replaying cached results
- The Agent plugin is purpose-built for AI coding agent workflows, not general regression testing
- Evals run only on demand (`--evals`) so they never add cost to a standard CI run
- PHPStan and Rector plugins are now first-party and installable via Composer
- Upgrading from Pest 4 is straightforward; PHPUnit 13 compatibility is the main consideration

---

*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%2Fwww.msaied.com%2Farticles%2Fpest-5-released-test-impact-analysis-agent-verification-and-evals-1&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%2Fwww.msaied.com%2Farticles%2Fpest-5-released-test-impact-analysis-agent-verification-and-evals-1) 

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

  3 questions  

     Q01  Does the TIA engine skip tests, or does it still count them toward coverage?        The TIA engine replays cached results rather than skipping tests. Each cached result stores the exact lines and branches the test covered, so --coverage reports and --min thresholds behave as though the full suite ran. 

      Q02  What does the Pest 5 Agent plugin actually do, and when should I use it?        The Agent plugin adds an --agent option that runs a code snippet inside a full Pest test environment, with factories, RefreshDatabase, and Laravel fakes available. It is designed to give AI coding agents a quick way to verify that a change works, not to replace committed regression tests. 

      Q03  What are the minimum requirements to upgrade to Pest 5?        Pest 5 requires PHP 8.4 or greater and PHPUnit 13. The TIA engine additionally requires PCOV or Xdebug to record its baseline. Pest itself has no API-level breaking changes beyond the version bumps. 

  Continue reading

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

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

 [ ![PostgreSQL CTEs, Window Functions, and Lateral Joins in Laravel](https://cdn.msaied.com/506/7d5fcddaf6c26c87a749a20b8bdffbfa.png) laravel postgresql sql 

### PostgreSQL CTEs, Window Functions, and Lateral Joins in Laravel

Go beyond basic Eloquent queries. Learn how to leverage PostgreSQL CTEs, window functions, and LATERAL joins d...

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

 4 Aug 2026     1 min read  

  Read    

 ](https://www.msaied.com/articles/postgresql-ctes-window-functions-and-lateral-joins-in-laravel-4) [ ![PhpStorm 2026.2 Released: Laravel Tool Window, PHP 8.5 Pipe Operator, and AI Agents](https://cdn.msaied.com/509/27bfaf4aff7b913b8c6c3a37df9dc143.png) PhpStorm PHP Laravel 

### PhpStorm 2026.2 Released: Laravel Tool Window, PHP 8.5 Pipe Operator, and AI Agents

PhpStorm 2026.2 ships a dedicated Laravel tool window with Artisan, error logs, and Laravel Cloud tabs, plus P...

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

 3 Aug 2026     3 min read  

  Read    

 ](https://www.msaied.com/articles/phpstorm-20262-released-laravel-tool-window-php-85-pipe-operator-and-ai-agents-1) [ ![PhpStorm 2026.2 Released: Laravel Tool Window, PHP 8.5 Pipe Operator, and AI Agents](https://cdn.msaied.com/505/151a0bba66cc27064e090e69e55d7c92.png) PhpStorm JetBrains PHP 8.5 

### PhpStorm 2026.2 Released: Laravel Tool Window, PHP 8.5 Pipe Operator, and AI Agents

PhpStorm 2026.2 ships a dedicated Laravel tool window with Artisan, error logs, and Laravel Cloud tabs, plus P...

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

 3 Aug 2026     3 min read  

  Read    

 ](https://www.msaied.com/articles/phpstorm-20262-released-laravel-tool-window-php-85-pipe-operator-and-ai-agents) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://www.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://www.msaied.com)
- [Projects](https://www.msaied.com/projects)
- [Articles](https://www.msaied.com/articles)
- [Certificates](https://www.msaied.com/certificates)
- [Contact](https://www.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)
