markhuot / craft-pest

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

Running `pest/test` adds a `cpresources` folder into the root of a project #71

Closed aaronbushnell closed 1 year ago

aaronbushnell commented 1 year ago

I noticed that if I run pest/test it will create a cpresources in the root of my project. It could be because I need to make a config change on my end, but wasn't sure if that was a known issue!

aaronbushnell commented 1 year ago

Oh, I see what's happening here. Because these are console requests you wind up in a similar situation when you run...

php craft clear-caches/cp-resources

...if you don't have an explicit @webroot alias set:

Clearing cache: Control panel resources
Error clearing cache Control panel resources: Unable to clear control panel resources because the location isn't known for console commands.
Explicitly set the @webroot alias in config/general.php to avoid this error.
See https://craftcms.com/docs/4.x/config/#aliases for more info.

If you find yourself in this boat you should just explicitly set @webroot in your config. Here's mine:

'@webroot' => dirname(__DIR__).'/web',

Doing that will ensure cpresources is placed appropriately when you run a console command like this!