Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Napo7's avatar
Level 15

New Laravel 11 project : missing PEST !?

Hi

I've heard that PEST should now be included in all new laravel 11 projects (according to the docs)

Just installed a new laravel 11 project (with laravel new my-project).

CD into it, make a test with php artisan make:test --pest NewTest

then run php artisan test, and I get an error Call to undefined function test().

Seems phpunit is still used to run the tests !

Moreover, the docs states that I should be able to run "vendor/bin/pest", but there is not pest binary in the vendor/bin folder !?

I also tried to initialize my project with composer create-project laravel/laravel example-app, but same behavior !

Am I the only one facing this ?

0 likes
3 replies
LaryAI's avatar
Level 58

It sounds like PEST is not being installed automatically with your new Laravel 11 project. This could be due to a variety of reasons, such as a misconfiguration or an issue with the Laravel installer. However, you can manually add PEST to your project. Here’s how you can do it:

  1. Install PEST via Composer: Run the following command to install PEST in your Laravel project:

    composer require pestphp/pest --dev
    
  2. Initialize PEST: After installing PEST, you need to initialize it. Run the following command:

    ./vendor/bin/pest --init
    
  3. Create a PEST Test: You can create a new PEST test using the artisan command:

    php artisan make:test --pest NewTest
    
  4. Run the Tests: Now you should be able to run your tests using PEST:

    ./vendor/bin/pest
    
  5. Verify the Installation: Ensure that the pest binary is available in the vendor/bin directory and that your tests directory contains the necessary PEST configuration files.

Here is a step-by-step example:

# Step 1: Install PEST
composer require pestphp/pest --dev

# Step 2: Initialize PEST
./vendor/bin/pest --init

# Step 3: Create a PEST test
php artisan make:test --pest NewTest

# Step 4: Run the tests
./vendor/bin/pest

If you follow these steps and still encounter issues, make sure your Composer dependencies are up to date by running:

composer update

Additionally, ensure that your composer.json file includes the PEST package under the require-dev section:

"require-dev": {
    "pestphp/pest": "^1.0"
}

By following these steps, you should be able to set up and use PEST in your new Laravel 11 project. If the problem persists, it might be worth checking the Laravel and PEST documentation for any updates or changes.

2 likes
tykus's avatar

The Laravel installer should prompt you for your preferred test framework


 ┌ Which testing framework do you prefer? ──────────────────────┐
 │ › ● Pest                                                     │
 │   ○ PHPUnit                                                  │
 └──────────────────────────────────────────────────────────────┘

Is your installer up-to-date?

PhilG's avatar

I just started a new demo project with the Laravel installer and I made sure to select the 'Pest' option as my testing framework. But it still did not generate the 'pest.php' file and the exemple test files are made with 'PHPUnit'.

I corrected it doing the steps provided by reply from the AI above and changed it did the trick.

Still weird that even if I chose 'Pest', it was not setup by default.

Please or to participate in this conversation.