# Pest

**Package:** Laravel Modules | **Version:** 3 | **URL:** https://mozex.dev/docs/laravel-modules/v3/integrations/pest

---

## Overview

Run tests across your application and all Modules using Pest. Pest uses `phpunit.xml` under the hood, so keep the PHPUnit configuration from the [PHPUnit integration](https://mozex.dev/docs/laravel-modules/v3/integrations/phpunit) and add a `Pest.php` bootstrap to include module tests.

## Setup

1. Keep or create `phpunit.xml` with a Modules suite (see [PHPUnit integration](https://mozex.dev/docs/laravel-modules/v3/integrations/phpunit)):
   `<directory>./Modules/*/Tests</directory>`
2. Create or update `tests/Pest.php`:

```php
<?php

use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;

uses(TestCase::class)->in('Feature', 'Unit');

// Apply TestCase to ALL module tests
// Path is relative to tests/Pest.php
uses(TestCase::class, RefreshDatabase::class)->in('../Modules/*/Tests/*/*');
```

## Running tests

```bash
./vendor/bin/pest

# Only module tests
./vendor/bin/pest --testsuite Modules

# Specific module
./vendor/bin/pest Modules/Blog/Tests
```

## Troubleshooting

- **No tests found**: verify `phpunit.xml` has the `Modules/*/Tests` suite and `Pest.php` globs point to actual test files.
- **Wrong path base**: `->in()` paths are relative to `tests/Pest.php` — adjust the `../` prefix if the file is moved.

## See also

- [PHPUnit Integration](https://mozex.dev/docs/laravel-modules/v3/integrations/phpunit)
- [Migrations](https://mozex.dev/docs/laravel-modules/v3/features/migrations)

---

## Table of Contents

- [Introduction](https://mozex.dev/docs/laravel-modules/v3)
- [Support Us](https://mozex.dev/docs/laravel-modules/v3/support-us)
- [Requirements](https://mozex.dev/docs/laravel-modules/v3/requirements)
- [Changelog](https://mozex.dev/docs/laravel-modules/v3/changelog)
- [Contributing](https://mozex.dev/docs/laravel-modules/v3/contributing)
- [Questions & Issues](https://mozex.dev/docs/laravel-modules/v3/questions-and-issues)
- [About Mozex](https://mozex.dev/docs/laravel-modules/v3/about)

### Features

- [Blade Components](https://mozex.dev/docs/laravel-modules/v3/features/blade-components)
- [Views](https://mozex.dev/docs/laravel-modules/v3/features/views)
- [Routes](https://mozex.dev/docs/laravel-modules/v3/features/routes)
- [Configs](https://mozex.dev/docs/laravel-modules/v3/features/configs)
- [Migrations](https://mozex.dev/docs/laravel-modules/v3/features/migrations)
- [Seeders](https://mozex.dev/docs/laravel-modules/v3/features/seeders)
- [Commands](https://mozex.dev/docs/laravel-modules/v3/features/commands)
- [Helpers](https://mozex.dev/docs/laravel-modules/v3/features/helpers)
- [Models & Factories](https://mozex.dev/docs/laravel-modules/v3/features/models-factories)
- [Policies](https://mozex.dev/docs/laravel-modules/v3/features/policies)
- [Events & Listeners](https://mozex.dev/docs/laravel-modules/v3/features/events-listeners)
- [Service Providers](https://mozex.dev/docs/laravel-modules/v3/features/service-providers)
- [Translations](https://mozex.dev/docs/laravel-modules/v3/features/translations)
- [Caching](https://mozex.dev/docs/laravel-modules/v3/features/caching)
- [Listing Modules](https://mozex.dev/docs/laravel-modules/v3/features/listing)
- [Livewire Components](https://mozex.dev/docs/laravel-modules/v3/features/livewire-components)
- [Filament](https://mozex.dev/docs/laravel-modules/v3/features/filament)
- [Nova Resources](https://mozex.dev/docs/laravel-modules/v3/features/nova-resources)

### Integrations

- [PHPStan](https://mozex.dev/docs/laravel-modules/v3/integrations/phpstan)
- [PHPUnit](https://mozex.dev/docs/laravel-modules/v3/integrations/phpunit)
- [Pest](https://mozex.dev/docs/laravel-modules/v3/integrations/pest)