pest: Can't install on Laravel 10

Hello, I am following the Laravel 10 upgrade guide, which says to update nunomaduro/collision to ^7.0, but this seems to conflict with PEST:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - pestphp/pest[v0.1.0, ..., v0.2.4] require php ^7.3 -> your php version (8.1.11) does not satisfy that requirement.
    - pestphp/pest[v0.3.0, ..., v0.3.19, v1.0.0, ..., v1.4.0] require nunomaduro/collision ^5.0 -> found nunomaduro/collision[v5.0.0, ..., v5.11.0] but it conflicts with your root composer.json require (^7.0).
    - pestphp/pest[v1.5.0, ..., v1.17.0] require nunomaduro/collision ^5.4.0 -> found nunomaduro/collision[v5.4.0, ..., v5.11.0] but it conflicts with your root composer.json require (^7.0).
    - pestphp/pest[v1.18.0, ..., v1.21.1] require nunomaduro/collision ^5.4.0|^6.0 -> found nunomaduro/collision[v5.4.0, ..., v5.11.0, v6.0.0, ..., v6.4.0] but it conflicts with your root composer.json require (^7.0).
    - pestphp/pest[v1.21.2, ..., v1.22.1] require nunomaduro/collision ^5.10.0|^6.0 -> found nunomaduro/collision[v5.10.0, v5.11.0, v6.0.0, ..., v6.4.0] but it conflicts with your root composer.json require (^7.0).
    - pestphp/pest[v1.22.2, ..., v1.22.4] require nunomaduro/collision ^5.11.0|^6.3.0 -> found nunomaduro/collision[v5.11.0, v6.3.0, v6.3.1, v6.3.2, v6.4.0] but it conflicts with your root composer.json require (^7.0).
    - Root composer.json requires pestphp/pest * -> satisfiable by pestphp/pest[v0.1.0, ..., v0.3.19, v1.0.0, ..., v1.22.4].

You can also try re-running composer require with an explicit version constraint, e.g. "composer require pestphp/pest:*" to figure out if any version is installable, or "composer require pestphp/pest:^2.1" if you know which you need.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 13
  • Comments: 15 (2 by maintainers)

Most upvoted comments

Hello everybody,

👍 I have installed Pest in Laravel 10:

Used the Laravel installer to create a new project and enter the folder:

laravel new my-app && cd my-app

Downgraded PHP Unit and Collision

composer require phpunit/phpunit:^9.6 nunomaduro/collision:^6.1 pestphp/pest --dev --with-all-dependencies

Init Pest

php artisan pest:install

and run tests:

php artisan test

Alternatively, I made sure to have the latest Laravel installed:

composer global upgrade laravel/installer

Then, created a new project with Pest tests and enter the folder:

laravel new my-app --pest && cd my-app

and finally, ran the tests:

php artisan test

note: PHPUnit v10.0 and Collision v7.0 will be supported in Pest v2 (yet to be released).

Probably Laravel 10 already brought phpunit 10.x by default, but it supports 9.x

As pest v1 has limited support for phpunit 9.x you can install it like this and wait for pest 2.x:

"nunomaduro/collision": "^6.0",
"phpunit/phpunit": "^9.6",

Run

composer update

Pest 2 will be released end February, and it will bring Collision to 7 support, and --profile support. Meanwhile, please follow these instructions: https://pestphp.com/docs/installation#installation

Hello, I am detailing my experience to execute the PEST command from my environment in Laravel Sail, to do so it is necessary to use the sail command.

For example, to initialize PEST and create the configuration file you would run: ./vendor/bin/sail pest --init

Now if you want to run the tests you can use the command: ./vendor/bin/sail pest

For more practicality you can create an alias in your operating system, this is an example in Linux or Windows (WSL): alias pest=‘./vendor/bin/sail pest’

I hope it will be useful to others with the same case.

Greetings,

@Andre-ADPC, looking at your shell prompt (λ) are you by any chance using Cmder (and Windows)? 👀 If so, try using vendor/bin/pest --init (removing the ./ as Windows does not support it.

Regarding the artisan pest:install command, I’m pretty sure this was removed in 2.x, in favour of the general vendor/bin/pest --init command.

Did a new test upgrading my project to Laravel 10. As long as I don’t change the phpunit version from ^9.5.10 => ^10.0, it works. So it looks like PestPhp needs to be updated to support nunomaduro/collision ^7.0

Confirmed, I have the same issue.