Open jonny-bull opened 1 year ago
It isn't necessarily what you're asking for, but, you can kind of achieve this already. I have a few solutions that might work for you:
WP_ENV_
environment variables to override individual configurations. You can use WP_ENV_CORE
and WP_ENV_PHP_VERSION
in your testing matrix, for instance, and conveniently run tests against different environments. This is a great solution for CI where you'll want the same plugins, configuration, and mapping, but, will want to run against different environments..wp-env.override.json
files that are dynamically generated. When you run whatever test you're thinking of you could copy the custom .wp-env.json
file and rename it, then, you can override whatever configuration you need in it. It's not perfect, but, it can get you mostly to where you want to be without needing to wait on an upstream change..wp-env.json
files. You can map directories using relative paths, so, you'd just need to go up a level (../
) and you could reference things in the rest of the repository. It isn't great, but, it's definitely an option!
What problem does this address?
Due to WordPress' backwards compatibility and large install base, it's important to make sure PRs work as well on PHP 8.1 as they do 7.4. The same applies to WordPress versions.
While
wp-env
is a very powerful and useful tool for quickly spinning up WP installs, it only allows for one configuration file:.wp-env.json
.This means anyone wishing to test multiple configurations would need to manually edit the
.wp-env.json
file to change whatwp-env
runs. It also prevents CI tooling from automatically picking a configuration to test against.What is your proposed solution?
Adding a
--config [MY-CONFIG-FILE]
flag towp-env start
would allow specifying a configuration file.This could be picked up by CI tooling in order to spin up multiple configurations of WordPress, installed plugins, themes, PHP versions.