File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
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)"
Original file line number Diff line number Diff line change 81
81
"test-php-multisite:view-transitions" : " wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/performance composer test-multisite:view-transitions" ,
82
82
"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" ,
83
83
"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" ,
84
85
"wp-env" : " wp-env" ,
85
86
"prepare" : " husky"
86
87
}
You can’t perform that action at this time.
0 commit comments