Skip to content

feat(config): add configurable WP-CLI command for wp-env 11+ - #31

Merged
Hug0-Drelon merged 5 commits into
masterfrom
feat-wp-cli-command
Oct 15, 2026
Merged

Hug0-Drelon merged 5 commits into
masterfrom
feat-wp-cli-command

Conversation

@Hug0-Drelon

@Hug0-Drelon Hug0-Drelon commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

What?

  • Add wpCliCommand option to getPlaywrightConfig() for wp-env 11+ setups using .wp-env.test.json
  • Add shared runWpCli() and getWpCliCommand() helpers for running WP-CLI commands in the test environment
  • Update createTranslator() to use the configurable command instead of a hardcoded tests-cli container
  • Fix getPlaywrightConfig() so spreading remaining Playwright options no longer overwrites merged use and webServer defaults
  • Document wpCliCommand, runWpCli, and getWpCliCommand() in README

Why?

wp-env 11+ deprecates the built-in tests-cli container in favor of separate config files (e.g. .wp-env.test.json with run cli). Consumer projects were duplicating runWpCli helpers and createTranslator was failing against the new setup.

How?

  • getPlaywrightConfig({ wpCliCommand }) sets WP_ENV_CLI_COMMAND at config load time
  • getWpCliCommand() resolves the base command from WP_ENV_CLI_COMMAND or falls back to npx wp-env run tests-cli
  • runWpCli(command, shellPrefix?) runs WP-CLI via the resolved command
  • setWpCliCommand() remains internal to the package (not publicly exported)
  • use, webServer, and wpCliCommand are destructured out of options before spreading remaining Playwright options

Test plan

  • npm run build passes
  • npm run lint:js passes
  • Consumer project configures wpCliCommand: 'npx wp-env --config=.wp-env.test.json run cli' and createTranslator() succeeds
  • Consumer project can replace local runWpCli helper with the package export

Add wpCliCommand option to getPlaywrightConfig, wpEnvRun helper, and
update createTranslator to use the shared command resolution.
…rver

Destructure use and webServer out of options before spreading
playwrightOptions so merged defaults are not replaced wholesale.
Aligns with getWpCliCommand/setWpCliCommand and verb-first naming.
@Hug0-Drelon
Hug0-Drelon merged commit f36fe23 into master Oct 15, 2026
3 checks passed
@Hug0-Drelon
Hug0-Drelon deleted the feat-wp-cli-command branch October 15, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant