markhuot / craft-pest

https://craft-pest.com
Other
38 stars 11 forks source link

Recommended way to install Pest on Craft 4.x site? #107

Closed aaronbushnell closed 7 months ago

aaronbushnell commented 8 months ago

I know this plugin has gone through some "under-the-hood" changes, but I'm curious the recommended way to install this plugin. Going to https://craft-pest.com instructs you to run composer require --dev markhuot/craft-pest-core. However, running this on one of my Craft 4 site's errors out with the following:

❯ composer require --dev markhuot/craft-pest-core

In PackageDiscoveryTrait.php line 331:

Could not find a version of package markhuot/craft-pest-core matching your minimum-stability (stable).
Require it with an explicit version constraint allowing its desired stability.                                                                                                                                                                           

When I run this with a specific version number I get a slightly different error:

❯ composer require --dev markhuot/craft-pest-core:2.0.0-rc6
./composer.json has been updated
Running composer update markhuot/craft-pest-core
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires markhuot/craft-pest-core 2.0.0-rc6 -> satisfiable by markhuot/craft-pest-core[2.0.0-rc6].
    - markhuot/craft-pest-core 2.0.0-rc6 requires symfony/process ^5.3|^6.0 -> found symfony/process[v5.3.0, ..., v5.4.34, v6.0.0, ..., v6.4.2] but the package is fixed to v4.4.44 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content
markhuot commented 7 months ago

To use Pest 2 you'll need to use craft-pest-core but that requires a newer version of symfony/process than Craft shipped with until 4.5. Basically, make sure you're running a recent version of Craft and then the above should work,

composer require --dev markhuot/craft-pest-core:2.0.0-rc6
aaronbushnell commented 7 months ago

Thank you, @markhuot!

markhuot commented 7 months ago

Soon this'll all be pointed to the same place, but there's some messy version constraints I'm trying to work through before I commit it all. Thanks for reaching out!

aaronbushnell commented 7 months ago

No problem at all! I figured things were in flux as you get things set on your side. Appreciate your work on this!