-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using npm run test:php results in errors related to cli #50690
Comments
OK, I discovered that using lint:php and test:unit:PHP as individual commands do work. Pinging @ObliviousHarmony and @noahtallen in case it is related to #50408 |
Ah, I think I know the problem:
You need to run But previously, you could run these commands without wp-env having been started. I think we should consider this scenario more -- I wonder if people often use these composer related scripts without using the rest of the env? |
Except wp-env is started. |
I normally use Local, meaning I don't have either docker or wp-env running: but I have learned that I do need both to run different tests. And that this is the only time I start them. |
Hm, that's odd. To help troubleshoot, could you provide the output from For me, that looks like this: npx wp-env --version
7.0.0
npx wp-env run cli ls
ℹ Starting 'ls' on the cli container.
index.php wp-admin wp-config.php wp-links-opml.php wp-settings.php
license.txt wp-blog-header.php wp-content wp-load.php wp-signup.php
readme.html wp-comments-post.php wp-cron.php wp-login.php wp-trackback.php
wp-activate.php wp-config-sample.php wp-includes wp-mail.php xmlrpc.php
✔ Ran `ls` in 'cli'. (in 0s 526ms) And the output for the test command looks like this: npx wp-env start
WordPress development site started at http://localhost:8888
WordPress test site started at http://localhost:8889
MySQL is listening on port 50066
MySQL for automated testing is listening on port 50067
✔ Done! (in 1s 915ms)
npm run test:php
> [email protected] test:php /Users/noahallen/source/gutenberg
> npm-run-all lint:php test:unit:php
> [email protected] prelint:php /Users/noahallen/source/gutenberg
> wp-env run --env-cwd='wp-content/plugins/gutenberg' cli composer update --no-interaction
ℹ Starting 'composer update --no-interaction' on the cli container.
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Lock file operations: 0 installs, 2 updates, 0 removals
- Upgrading nikic/php-parser (v4.15.4 => v4.15.5)
- Upgrading phpunit/phpunit (9.6.7 => 9.6.8)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 2 updates, 0 removals
- Downloading nikic/php-parser (v4.15.5)
- Downloading phpunit/phpunit (9.6.8)
- Upgrading nikic/php-parser (v4.15.4 => v4.15.5): Extracting archive
- Upgrading phpunit/phpunit (9.6.7 => 9.6.8): Extracting archive
Generating autoload files
45 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
✔ Ran `composer update --no-interaction` in 'cli'. (in 29s 121ms)
> [email protected] lint:php /Users/noahallen/source/gutenberg
> wp-env run --env-cwd="wp-content/plugins/gutenberg" cli composer run-script lint
ℹ Starting 'composer run-script lint' on the cli container.
> phpcs --standard=phpcs.xml.dist
...
Time: 20.94 secs; Memory: 56MB
✔ Ran `composer run-script lint` in 'cli'. (in 22s 332ms)
> [email protected] pretest:unit:php /Users/noahallen/source/gutenberg
> wp-env start
WordPress development site started at http://localhost:8888
WordPress test site started at http://localhost:8889
MySQL is listening on port 50066
MySQL for automated testing is listening on port 50067
✔ Done! (in 0s 753ms)
> [email protected] test:unit:php /Users/noahallen/source/gutenberg
> wp-env run --env-cwd="wp-content/plugins/gutenberg" tests-wordpress vendor/bin/phpunit -c phpunit.xml.dist --verbose
ℹ Starting 'vendor/bin/phpunit -c phpunit.xml.dist --verbose' on the tests-wordpress container.
[23-May-2023 17:41:32 UTC] PHP Warning: Constant WP_DEBUG already defined in /wordpress-phpunit/wp-tests-config.php on line 214
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHPUnit 9.6.8 by Sebastian Bergmann and contributors.
Runtime: PHP 8.0.28
Configuration: phpunit.xml.dist
...
WARNINGS!
Tests: 1197, Assertions: 2222, Warnings: 34.
✔ Ran `vendor/bin/phpunit -c phpunit.xml.dist --verbose` in 'tests-wordpress'. (in 24s 122ms) |
I have also had cases where Docker's logs show startup errors and give actionable content. You can do this using |
Today I successfully ran the php tests twice. Then after some time of working on Gutenberg PR's, it stops working and I can't even stop or restart wp-env. When trying to stop it, it tells me there is no exit command. I eventually restarted the mac and this is the result after the restart: npx wp-env --version npx wp-env run cli ls
Expand to see the log: docker-compose -f $(npx wp-env install-path)/docker-compose.yml logs ✔ (in 0s 488ms)
|
That's very strange @carolinan. What was the specific output
This output looks like
This might be the cause. I don't think any of the breaking changes we've made would cause this aggressive a failure, but, it might be something to consider in terms of reproducibility. |
Yes after restarting it worked fine, but I had to end my work day. I'll see what happens tomorrow. |
I forgot about this issue. To confirm, I ran the commands from within the Gutenberg directory today without issues, so I am closing it. |
Description
I am no longer able to use
npm run test:php
.error tldr:
Am I missing a command?
I am using MacOs 13.3.1
Docker Desktop 4.19.0
node v14.20.0 (npm v6.14.18)
Composer version 2.5.5
ℹ Starting 'composer update --no-interaction' on the cli container.
service "cli" is not running container #1
✖ Command failed with exit code 1
Command failed with exit code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] prelint:php:
wp-env run --env-cwd='wp-content/plugins/gutenberg' cli composer update --no-interaction
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] prelint:php script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/carolina/.npm/_logs/2023-05-17T08_54_46_955Z-debug.log
ERROR: "lint:php" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test:php:
npm-run-all lint:php test:unit:php
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test:php script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Step-by-step reproduction instructions
In your Gutenberg developer environment try to use the command
npm run test:php
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: