Skip to content

Commit faba588

Browse files
schlesseraclaude
andcommitted
Keep running the scenarios one after the other on Windows
Run Behat through the PHP binary, as a shell script cannot be run directly on Windows, and do not hand the run to the parallel runner there at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent dbf031d commit faba588

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎bin/run-behat-tests‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ done
274274
# Every worker but the first uses its own test database, which the test user needs
275275
# to be allowed to create, as set up by "composer prepare-tests".
276276
PARALLEL="${WP_CLI_TEST_PARALLEL-}"
277+
case "$(uname -s)" in
278+
MINGW*|MSYS*|CYGWIN*)
279+
PARALLEL="";;
280+
esac
277281
if [ -n "${PARALLEL}" ] && [ "${PARALLEL}" != "1" ]; then
278282
if ! is_numeric "${PARALLEL}"; then
279283
echo "Warning: WP_CLI_TEST_PARALLEL is not a number of workers, running the scenarios one after the other." >&2

‎utils/behat-parallel.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function wp_cli_tests_failures_file() {
4747
* @param array<string> $args
4848
*/
4949
function wp_cli_tests_run_behat_and_exit( array $args ) {
50-
$command = 'vendor/bin/behat ' . implode( ' ', array_map( 'escapeshellarg', $args ) );
50+
$command = escapeshellarg( PHP_BINARY ) . ' vendor/bin/behat ' . implode( ' ', array_map( 'escapeshellarg', $args ) );
5151
passthru( $command, $exit_code );
5252
exit( $exit_code );
5353
}
@@ -204,7 +204,7 @@ static function ( $a, $b ) {
204204
$copy = $failures . '.' . getmypid() . '.scenarios';
205205
rename( $failures, $copy );
206206
register_shutdown_function( 'unlink', $copy );
207-
$command = 'vendor/bin/behat ' . implode( ' ', array_map( 'escapeshellarg', array_merge( $behat_args, array_values( $user_args ), [ $copy ] ) ) );
207+
$command = escapeshellarg( PHP_BINARY ) . ' vendor/bin/behat ' . implode( ' ', array_map( 'escapeshellarg', array_merge( $behat_args, array_values( $user_args ), [ $copy ] ) ) );
208208
passthru( $command, $exit_code );
209209
exit( $exit_code );
210210
}
@@ -265,7 +265,7 @@ static function ( $a, $b ) {
265265
}
266266

267267
$output = "{$base_dir}/worker-{$index}.log";
268-
$command = 'vendor/bin/behat ' . implode( ' ', array_map( 'escapeshellarg', array_merge( $all_args, [ $list ] ) ) );
268+
$command = escapeshellarg( PHP_BINARY ) . ' vendor/bin/behat ' . implode( ' ', array_map( 'escapeshellarg', array_merge( $all_args, [ $list ] ) ) );
269269

270270
$procs[ $index ] = [
271271
'proc' => proc_open(

0 commit comments

Comments
 (0)