Skip to content

Commit f356d46

Browse files
Merge branch 'trunk' into publish/auto-sizes-1-6-0
2 parents b256860 + 42bb977 commit f356d46

File tree

71 files changed

+615
-344
lines changed

Some content is hidden

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

71 files changed

+615
-344
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.lock

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

package-lock.json

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

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
},
99
"dependencies": {
1010
"@builder.io/partytown": "github:westonruter/partytown#add/wp-i18n-workaround",
11-
"web-vitals": "5.0.3"
11+
"web-vitals": "5.1.0"
1212
},
1313
"devDependencies": {
1414
"@octokit/rest": "^22.0.0",
15-
"@playwright/test": "^1.54.1",
16-
"@types/node": "^24.1.0",
15+
"@playwright/test": "^1.54.2",
16+
"@types/node": "^24.2.0",
1717
"@wordpress/e2e-test-utils-playwright": "^1.27.0",
1818
"@wordpress/env": "^10.27.0",
1919
"@wordpress/prettier-config": "^4.25.0",
@@ -24,10 +24,10 @@
2424
"fast-glob": "^3.3.3",
2525
"fs-extra": "^11.3.0",
2626
"husky": "^9.1.7",
27-
"lint-staged": "^16.1.2",
27+
"lint-staged": "^16.1.4",
2828
"lodash": "4.17.21",
2929
"npm-run-all": "^4.1.5",
30-
"typescript": "^5.8.3",
30+
"typescript": "^5.9.2",
3131
"webpackbar": "^7.0.0"
3232
},
3333
"scripts": {
@@ -81,6 +81,7 @@
8181
"test-php-multisite:view-transitions": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/performance composer test-multisite:view-transitions",
8282
"test-php-multisite:web-worker-offloading": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/performance composer test-multisite:web-worker-offloading",
8383
"test-php-multisite:webp-uploads": "wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/performance composer test-multisite:webp-uploads",
84+
"update-test-case-snapshots": "bin/update-test-case-snapshots.sh",
8485
"wp-env": "wp-env",
8586
"prepare": "husky"
8687
}

plugins/embed-optimizer/tests/test-cases/nested-figure-embed/expected.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/embed-optimizer/tests/test-cases/single-spotify-embed-outside-viewport-with-subsequent-script/expected.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-inside-viewport/expected.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport-on-mobile/expected.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/embed-optimizer/tests/test-cases/single-wordpress-tv-embed-outside-viewport/expected.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)