From a4bd09fb858bab602a710bb505d998916c347eea Mon Sep 17 00:00:00 2001 From: Kamran Abdul Aziz Date: Thu, 10 Sep 2026 13:27:16 +0530 Subject: [PATCH 1/2] Run npm verbosely when debug mode is enabled When an npm command hangs or misbehaves during preparation, the runner shows nothing that explains where it is stuck. Append --loglevel=silly to the npm install and build commands when WPT_DEBUG is set, matching how debug mode already adds verbosity to the rsync operations. Default behavior is unchanged. Based on the approach in #221 by @rollecode, updated to gate the verbosity behind WPT_DEBUG as suggested in the review discussion. --- .env.default | 3 ++- README.md | 4 ++-- prepare.php | 7 ++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.env.default b/.env.default index df58ae0..3f38c21 100644 --- a/.env.default +++ b/.env.default @@ -60,7 +60,8 @@ export WPT_SSH_PRIVATE_KEY_BASE64="" # Whether to enable debug Mode. # # Enabling debug mode will output verbose logging and details about each part -# of the test runner. +# of the test runner. It also runs npm install and build commands with +# --loglevel=silly during preparation. # # 0 = Debug mode off # 1 = Debug mode on diff --git a/README.md b/README.md index 73917db..26b8c9c 100644 --- a/README.md +++ b/README.md @@ -236,7 +236,7 @@ export WPT_SSH_OPTIONS="" export WPT_SSH_PRIVATE_KEY_BASE64="" # Output logging -# Use 'verbose' to increase verbosity +# Use 'verbose' to increase verbosity; also runs npm with --loglevel=silly export WPT_DEBUG="" # Certificate validation @@ -390,7 +390,7 @@ export WPT_SSH_PRIVATE_KEY_BASE64="" **Output logging** -Output logging. Use 'verbose' to increase verbosity. +Output logging. Use 'verbose' to increase verbosity. When set, the npm install and build commands during preparation also run with `--loglevel=silly`. ``` export WPT_DEBUG="" diff --git a/prepare.php b/prepare.php index 9473ca2..aaf2e4e 100644 --- a/prepare.php +++ b/prepare.php @@ -84,6 +84,11 @@ * - Clones the WordPress/wordpress-develop repository from GitHub. * - Install npm dependencies and run the build script. */ +// When debug mode is enabled, run npm at its most verbose logging level, so a +// hung or slow npm command shows what it is doing instead of sitting silent. +// The same debug mode adds verbosity to the rsync operations further down. +$npm_verbosity = $runner_vars['WPT_DEBUG'] ? ' --loglevel=silly' : ''; + // Prepare an array of shell commands to set up the testing environment. perform_operations( array( @@ -96,7 +101,7 @@ 'git clone --depth=1 https://github.com/WordPress/wordpress-develop.git ' . escapeshellarg( $runner_vars['WPT_PREPARE_DIR'] ), // Change directory to the preparation directory, install npm dependencies, and build the project. - 'cd ' . escapeshellarg( $runner_vars['WPT_PREPARE_DIR'] ) . '; npm install && npm run build', + 'cd ' . escapeshellarg( $runner_vars['WPT_PREPARE_DIR'] ) . '; npm install' . $npm_verbosity . ' && npm run build' . $npm_verbosity, ) ); From c1599799229c826695c814e554493536a3be84d7 Mon Sep 17 00:00:00 2001 From: Kamran Abdul Aziz Date: Tue, 29 Sep 2026 20:25:59 +0530 Subject: [PATCH 2/2] Move the npm verbosity setup above the checkout comment block Keeps the existing block attached to the perform_operations() call it describes and uses the file's multi-line comment style, as suggested in review. --- prepare.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/prepare.php b/prepare.php index ddcda71..d503cfc 100644 --- a/prepare.php +++ b/prepare.php @@ -76,6 +76,13 @@ } +/* + * When debug mode is enabled, run npm at its most verbose logging level, so a + * hung or slow npm command shows what it is doing instead of sitting silent. + * The same debug mode adds verbosity to the rsync operations further down. + */ +$npm_verbosity = $runner_vars['WPT_DEBUG'] ? ' --loglevel=silly' : ''; + /* * Checkout and prepare wordpress-develop for testing. * @@ -84,11 +91,6 @@ * - Clones the WordPress/wordpress-develop repository from GitHub. * - Install npm dependencies and run the build script. */ -// When debug mode is enabled, run npm at its most verbose logging level, so a -// hung or slow npm command shows what it is doing instead of sitting silent. -// The same debug mode adds verbosity to the rsync operations further down. -$npm_verbosity = $runner_vars['WPT_DEBUG'] ? ' --loglevel=silly' : ''; - // Prepare an array of shell commands to set up the testing environment. perform_operations( array(