You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deprecation warning for wp-env tests environment #2437
ContributorDayIssues flagged as Contributor Day candidates.InfrastructureIssues for the overall performance plugin infrastructure[Type] BugAn existing feature is broken
When running npm run wp-env start, I'm seeing a warning in the terminal:
⚠ Warning: wp-env starts both development and tests environments by default.
This behavior is deprecated and will be removed in a future version.
To avoid this warning, add "testsEnvironment": false to your .wp-env.json.
The "env", "testsPort", and "testsEnvironment" options are also deprecated.
Use the --config option with a separate config file for test environments instead.
We need to ensure that the tests environment doesn't go away, or else we need to revisit how we handle tests.
I also faced a maddening issue whereby once I run npx wp-env start, any changes I made to the codebase aren't reflected anymore when I run tests. I have to explicitly run npx wp-env start --update or else destroy and start anew. The workaround for me on MacOS is to create a symlink in the tests-src back to the repo. It made this script for me:
fix-wp-env-tests-src-bind-mount.sh
#!/bin/bash## Fixes the wp-env tests-src bind mount so that file changes are reflected# immediately in the container without needing to run `npx wp-env start --update`.## Background: wp-env copies project files into a `tests-src` directory that is# bind-mounted at /var/www/html. It also creates a separate bind mount for the# performance plugin mapping at /var/www/html/wp-content/plugins/performance.# However, Docker Desktop on macOS does not properly overlay the child bind mount# on top of the parent, so the stale copy in tests-src is served instead. This# script replaces that stale copy with a symlink to the actual source directory,# which Docker follows through the parent mount.## Run this after `npx wp-env destroy && npx wp-env start` or `npx wp-env start --update`.set -e
REPO_DIR="$(cd "$(dirname "$0")/.."&& pwd)"
INSTALL_PATH="$(npx wp-env status --json 2>/dev/null | python3 -c "import json,sys; print(json.load(sys.stdin)['installPath'])"2>/dev/null)"if [ -z"$INSTALL_PATH" ];thenecho"Error: Could not determine wp-env install path."echo"Make sure wp-env is running: npx wp-env start"exit 1
fi
TARGET="$INSTALL_PATH/tests-src/wp-content/plugins/performance"if [ -L"$TARGET" ];thenecho"Already a symlink: $TARGET"echo"Nothing to do."exit 0
fiif [ !-e"$TARGET" ];thenecho"Error: $TARGET does not exist."echo"Make sure wp-env is running: npx wp-env start"exit 1
fiecho"Stopping wp-env..."
npx wp-env stop
echo"Removing stale copy: $TARGET"
rm -rf "$TARGET"echo"Creating symlink: $TARGET -> $REPO_DIR"
ln -s "$REPO_DIR""$TARGET"echo"Starting wp-env..."
npx wp-env start
echo"Done! File changes will now be reflected immediately in the tests container."
Claude drafted an issue title and description for this issue.
Title: Mappings in .wp-env.json are not live bind-mounted on Docker Desktop for macOS — file changes require --update
Description:
When using mappings in .wp-env.json to map the project root into the tests container, file changes on the host are not reflected in the container. This means every edit to a test file (or any mapped file) requires running npx wp-env start --update before the change is picked up, making the development workflow extremely slow.
Create or modify a file on the host inside the mapped directory
Check the container — the change is not visible:
echo "test" > ./testfile.txt
npx wp-env run tests-cli -- cat /var/www/html/wp-content/plugins/performance/testfile.txt
# Shows old content or "No such file or directory"
Root cause:
wp-env bind-mounts the WordPress installation directory (tests-src) at /var/www/html, and then creates a separate child bind mount for the mapping at /var/www/html/wp-content/plugins/performance. However, Docker Desktop on macOS does not properly overlay the child bind mount on top of the parent. The tests-src directory contains a copy of the mapped files (placed there during wp-env start or --update), and this stale copy is always served instead of the live bind mount.
This can be confirmed by checking /proc/mounts inside the container — only a single mount at /var/www/html is visible, with no separate mount for the mapping path.
Workaround:
Replace the stale copy in tests-src with a symlink to the actual source directory. Docker follows the symlink through the parent mount, restoring live file syncing:
For the Performance repo, the mappings is needed because the plugins array mounts each individual plugin at /var/www/html/wp-content/plugins/<slug>, but the test runner needs the monorepo root — composer.json, vendor/ (with PHPUnit), phpunit.xml.dist, and the test bootstrap files. The npm test scripts all use:
wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/performance composer test:<plugin>
Without the mapping, /var/www/html/wp-content/plugins/performance wouldn't have composer.json, vendor/bin/phpunit, or phpunit.xml.dist, so none of the test commands would work.
ContributorDayIssues flagged as Contributor Day candidates.InfrastructureIssues for the overall performance plugin infrastructure[Type] BugAn existing feature is broken
Activity
[-]Deprecation warning for wp-env tests envirionment[/-][+]Deprecation warning for wp-env tests environment[/+]westonruter commentedon Apr 2, 2026
I also faced a maddening issue whereby once I run
npx wp-env start, any changes I made to the codebase aren't reflected anymore when I run tests. I have to explicitly runnpx wp-env start --updateor else destroy and start anew. The workaround for me on MacOS is to create a symlink in thetests-srcback to the repo. It made this script for me:fix-wp-env-tests-src-bind-mount.shClaude drafted an issue title and description for this issue.
Title: Mappings in
.wp-env.jsonare not live bind-mounted on Docker Desktop for macOS — file changes require--updateDescription:
When using
mappingsin.wp-env.jsonto map the project root into the tests container, file changes on the host are not reflected in the container. This means every edit to a test file (or any mapped file) requires runningnpx wp-env start --updatebefore the change is picked up, making the development workflow extremely slow.Steps to reproduce:
.wp-env.jsonwith a mapping like:{ "env": { "tests": { "mappings": { "wp-content/plugins/performance": "." } } } }npx wp-env startRoot cause:
wp-env bind-mounts the WordPress installation directory (
tests-src) at/var/www/html, and then creates a separate child bind mount for the mapping at/var/www/html/wp-content/plugins/performance. However, Docker Desktop on macOS does not properly overlay the child bind mount on top of the parent. Thetests-srcdirectory contains a copy of the mapped files (placed there duringwp-env startor--update), and this stale copy is always served instead of the live bind mount.This can be confirmed by checking
/proc/mountsinside the container — only a single mount at/var/www/htmlis visible, with no separate mount for the mapping path.Workaround:
Replace the stale copy in
tests-srcwith a symlink to the actual source directory. Docker follows the symlink through the parent mount, restoring live file syncing:This symlink is destroyed by
wp-env destroyorwp-env start --updateand must be recreated afterward.Environment:
@wordpress/env(version from npm)Aside:
For the Performance repo, the
mappingsis needed because thepluginsarray mounts each individual plugin at/var/www/html/wp-content/plugins/<slug>, but the test runner needs the monorepo root —composer.json,vendor/(with PHPUnit),phpunit.xml.dist, and the test bootstrap files. The npm test scripts all use:Without the mapping,
/var/www/html/wp-content/plugins/performancewouldn't havecomposer.json,vendor/bin/phpunit, orphpunit.xml.dist, so none of the test commands would work.westonruter commentedon Apr 2, 2026
Something else that had broken for me: 654d69b fixed as part of #2436.
westonruter commentedon Apr 13, 2026
Maybe related: WordPress/gutenberg#76930
See Slack: https://wordpress.slack.com/archives/C02QB8GMM/p1775706867355449?thread_ts=1775706867.355449&cid=C02QB8GMM