Skip to content

Commit 79d8dda

Browse files
schlesseraclaude
andcommitted
Rerun the failures of a parallel run without the parallel setting
The rerun of a parallel run has to go through the parallel runner, which knows which scenarios failed. Otherwise Behat's own rerun cache, which does not match the workers' arguments, runs every scenario again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 002c2ce commit 79d8dda

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎bin/run-behat-tests‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,15 @@ 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+
278+
# A rerun after a parallel run covers exactly the scenarios that failed in it, which only the
279+
# parallel runner knows, whether or not WP_CLI_TEST_PARALLEL is set for the rerun as well.
280+
for arg in "$@"; do
281+
if [ "$arg" = "--rerun" ] && [ -f "${TMPDIR:-/tmp}/wp-cli-test-parallel-failures.scenarios" ]; then
282+
exec php "$WP_CLI_TESTS_ROOT"/utils/behat-parallel.php 1 --snippets-for="WP_CLI\Tests\Context\FeatureContext" "${FORMAT_ARGS[@]}" "$BEHAT_TAGS" --strict "${BEHAT_EXTRA_ARGS[@]}" -- "$@"
283+
fi
284+
done
285+
277286
case "$(uname -s)" in
278287
MINGW*|MSYS*|CYGWIN*)
279288
PARALLEL="";;

0 commit comments

Comments
 (0)