Skip to content

Commit 0f64fc8

Browse files
committed
Merge branch 'trunk' of https://github.com/WordPress/performance into add/authenticated-speculative-loading
2 parents 659956e + 4370563 commit 0f64fc8

File tree

66 files changed

+835
-603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+835
-603
lines changed

bin/test-php-watch.sh

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
#!/bin/bash
2-
if ! which inotifywait >/dev/null 2>&1; then
3-
echo "Error: the inotifywait command is not available. Make sure you have inotify-tools installed."
4-
exit 1
2+
3+
# Check for the fswatch command
4+
if ! command -v fswatch >/dev/null 2>&1; then
5+
echo "Error: The fswatch command is not available."
6+
echo "On macOS, you can install it with Homebrew: brew install fswatch"
7+
exit 1
58
fi
69

10+
cd "$(git rev-parse --show-toplevel)"
11+
712
while true; do
813
echo "Waiting for a change in the plugins directory..."
9-
output=$(inotifywait -e modify,create,delete -r ./plugins --include '.*(\.php$|/tests/.*)' 2> /dev/null)
10-
plugin_slug=$(echo "$output" | awk -F/ '{print $3}')
14+
15+
file=$(fswatch -1 -r \
16+
--event Created \
17+
--event Updated \
18+
--event Removed \
19+
--include '\.php$' \
20+
--include '/tests/' \
21+
./plugins 2>/dev/null | head -n 1)
22+
23+
# Make the file path relative.
24+
file="${file#"$PWD/"}"
25+
26+
plugin_slug=$(echo "$file" | awk -F/ '{print $2}')
1127
sleep 1 # Give the user a chance to copy text from terminal before IDE auto-saves.
1228
clear
1329
echo "Running phpunit tests for $(tput bold)$plugin_slug$(tput sgr0):"

bin/update-test-case-snapshots.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# Updates snapshots used for testing Optimization Detective
3+
# Move actual.html files on top of an expected.html file in directories that also contain buffer.html files.
4+
5+
set -e
6+
7+
cd "$(git rev-parse --show-toplevel)"
8+
9+
count=0
10+
11+
while IFS= read -r -d '' actual_file; do
12+
dir_path=$(dirname "$actual_file")
13+
buffer_file="$dir_path/buffer.html"
14+
if [ ! -e "$buffer_file" ]; then
15+
continue
16+
fi
17+
expected_file="$dir_path/expected.html"
18+
19+
count=$((count + 1))
20+
21+
mv "$actual_file" "$expected_file"
22+
echo "Updated $expected_file"
23+
done < <(find plugins -name 'actual.html' -path '*/test-cases/*' -print0)
24+
25+
echo "Performed $count snapshot update(s)"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"yoast/phpunit-polyfills": "^4.0",
5252
"phpstan/php-8-stubs": "^0.4.0",
5353
"phpstan/phpstan-strict-rules": "^1.6",
54-
"wpackagist-plugin/plugin-check": "^1.5"
54+
"wpackagist-plugin/plugin-check": "^1.6"
5555
},
5656
"config": {
5757
"allow-plugins": {

composer.lock

Lines changed: 73 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)