Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ cd ./wpp-research || exit

# Benchmark Web Vitals

npm run research --silent -- benchmark-web-vitals -u http://localhost:8881/ -n 20 -p -o csv > before.csv
npm run research --silent -- benchmark-web-vitals -u http://localhost:8891/ -n 20 -p -o csv > after.csv
npm run research --silent -- benchmark-web-vitals -u http://localhost:8881/ -n 20 -c "Fast 4G" -p -o csv > before.csv
npm run research --silent -- benchmark-web-vitals -u http://localhost:8891/ -n 20 -c "Fast 4G" -p -o csv > after.csv
Comment on lines +109 to +110

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve the script's flexibility, it's better to use a variable for the network condition instead of a hardcoded string. This allows for easier configuration of the benchmark without modifying the script. The suggested change introduces a CONNECTION variable with a default value of 'Fast 4G', so it can be overridden from the environment if needed.

Suggested change
npm run research --silent -- benchmark-web-vitals -u http://localhost:8881/ -n 20 -c "Fast 4G" -p -o csv > before.csv
npm run research --silent -- benchmark-web-vitals -u http://localhost:8891/ -n 20 -c "Fast 4G" -p -o csv > after.csv
npm run research --silent -- benchmark-web-vitals -u http://localhost:8881/ -n 20 -c "${CONNECTION:-Fast 4G}" -p -o csv > before.csv
npm run research --silent -- benchmark-web-vitals -u http://localhost:8891/ -n 20 -c "${CONNECTION:-Fast 4G}" -p -o csv > after.csv

if [[ $PRINT_TO_FILES == 'true' ]]; then
if [[ $OUTPUT == 'csv' ]]; then
node ../scripts/results.js "Web Vitals ($THEME)" before.csv after.csv $OUTPUT $SKIP_FORMATTING > web-vitals-$THEME.csv
Expand Down