Skip to content

Fix wp-env warning#1237

Merged
davidperezgar merged 6 commits intotrunkfrom
1236-fix-warning
Mar 26, 2026
Merged

Fix wp-env warning#1237
davidperezgar merged 6 commits intotrunkfrom
1236-fix-warning

Conversation

@ernilambar
Copy link
Member

@ernilambar ernilambar commented Mar 25, 2026

Fixes #1236

  • Fix .wp-env.json indentation to use 2-space indentation (per .editorconfig)
  • Fix .wp-env.tests.json indentation to use 2-space indentation (per .editorconfig)
  • Remove deprecated testsEnvironment: false from .wp-env.tests.json
  • Remove deprecated testsEnvironment: false from .wp-env.json
  • Update .github/workflows/php-test.yml to use dedicated npm scripts (wp-env:start:tests) instead of hard-coded commands
  • Fix CI port conflict: add explicit testsPort: 8890 to .wp-env.tests.json so dev (8889) and tests (8890) environments don't share the same port

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@ernilambar ernilambar marked this pull request as ready for review March 26, 2026 05:25
@github-actions
Copy link

github-actions bot commented Mar 26, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @Copilot.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: Copilot.

Co-authored-by: ernilambar <nilambar@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>
Co-authored-by: davidperezgar <davidperez@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the project’s wp-env configuration and documentation to avoid the deprecation warning introduced in @wordpress/env v11+ by separating development and test environment usage.

Changes:

  • Add a dedicated .wp-env.tests.json config and npm scripts for starting/stopping the test stack.
  • Update PHP tooling/test scripts to run wp-env commands with an explicit --config.
  • Refresh docs/CI triggers to reference the new test config and scripts.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json Adds test stack scripts and updates PHP-related wp-env commands to use --config=.wp-env.tests.json.
docs/running-unit-tests.md Updates local unit test instructions to start the new tests stack script.
README.md Documents separate dev vs test stacks and how to start/stop each.
.wp-env.tests.json Introduces separate wp-env config intended for test runs.
.wp-env.json Updates base wp-env config to include schema and disable tests environment by default.
.gitignore Ignores tests override config file.
.github/workflows/php-test.yml Ensures CI triggers on .wp-env.tests.json changes and starts wp-env with the tests config.
.gitattributes Excludes .wp-env.tests.json from export archives.
.distignore Excludes the new tests config/override from plugin distribution builds.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

.wp-env.json Outdated
Comment on lines +2 to +5
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"core": null,
"plugins": [ "." ],
"testsEnvironment": false
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.wp-env.json uses tab indentation, but .editorconfig specifies indent_style = space and indent_size = 2 for *.json. Please reformat this JSON to match the repository’s formatting rules to avoid churn in future diffs.

Suggested change
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"core": null,
"plugins": [ "." ],
"testsEnvironment": false
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"core": null,
"plugins": [ "." ],
"testsEnvironment": false

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +7
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"core": null,
"plugins": [ "." ],
"testsEnvironment": false,
"phpVersion": "7.4",
"port": 8889
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.wp-env.tests.json uses tab indentation, but .editorconfig enforces 2-space indentation for *.json. Please reformat this file accordingly to keep JSON formatting consistent across the repo.

Suggested change
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"core": null,
"plugins": [ "." ],
"testsEnvironment": false,
"phpVersion": "7.4",
"port": 8889
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"core": null,
"plugins": [ "." ],
"testsEnvironment": false,
"phpVersion": "7.4",
"port": 8889

Copilot uses AI. Check for mistakes.
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"core": null,
"plugins": [ "." ],
"testsEnvironment": false,
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new .wp-env.tests.json still sets testsEnvironment: false, but the wp-env warning (and issue linked in the PR) indicates testsEnvironment itself is deprecated. If this flag isn’t required for the separate tests config, drop it to avoid relying on an option slated for removal.

Suggested change
"testsEnvironment": false,

Copilot uses AI. Check for mistakes.
@ernilambar
Copy link
Member Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Mar 26, 2026

@ernilambar I've opened a new pull request, #1239, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 3 commits March 26, 2026 05:39
Fix wp-env deprecation warning: separate dev/test configs and clean up formatting
@ernilambar
Copy link
Member Author

@copilot Tests are failing with following errors:

> wp-env:start:tests
> wp-env start --config=.wp-env.tests.json

✖ The "development" and "tests" environments may not have the same port.
Error: Process completed with exit code 1.

Copy link
Contributor

Copilot AI commented Mar 26, 2026

@copilot Tests are failing with following errors:

> wp-env:start:tests

...

Fixed in aaa351f. The issue was that wp-env's default testsPort is 8889 (the classic tests port), so with "port": 8889 set for the development environment both environments ended up on the same port. Added an explicit "testsPort": 8890 to .wp-env.tests.json to resolve the conflict.

@davidperezgar davidperezgar merged commit 8341b17 into trunk Mar 26, 2026
18 checks passed
@davidperezgar davidperezgar deleted the 1236-fix-warning branch March 26, 2026 22:35
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.

Deprecation warning by wp-env

5 participants