Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make metadata tests more resilient. #6771

Merged
merged 2 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion scripts/gulpfiles/test_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ function compareSize(file, expected) {
const stat = fs.statSync(name);
const size = stat.size;

if (size > compare) {
if (!compare) {
const message = `Failed: Previous size of ${name} is undefined.`;
console.log(`${BOLD_RED}${message}${ANSI_RESET}`);
return 1;
} else if (size > compare) {
gonfunko marked this conversation as resolved.
Show resolved Hide resolved
const message = `Failed: ` +
`Size of ${name} has grown more than 10%. ${size} vs ${expected}`;
console.log(`${BOLD_RED}${message}${ANSI_RESET}`);
Expand Down
8 changes: 4 additions & 4 deletions tests/scripts/check_metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ readonly RELEASE_DIR='dist'
# Q3 2022 8.0.0 1040413 (mid-quarter typescript conversion)
# Q4 2022 8.0.0 870104
# Q4 2022 9.1.1 903357
readonly BLOCKLY_SIZE_EXPECTED= 903357
readonly BLOCKLY_SIZE_EXPECTED=903357

# Size of blocks_compressed.js
# Q2 2019 2.20190722.0 75618
Expand All @@ -52,7 +52,7 @@ readonly BLOCKLY_SIZE_EXPECTED= 903357
# Q3 2022 8.0.0 102176 (mid-quarter typescript conversion)
# Q4 2022 8.0.0 102213
# Q4 2022 9.1.1 102190
readonly BLOCKS_SIZE_EXPECTED= 102190
readonly BLOCKS_SIZE_EXPECTED=102190

# Size of blockly_compressed.js.gz
# Q2 2019 2.20190722.0 180925
Expand All @@ -72,7 +72,7 @@ readonly BLOCKS_SIZE_EXPECTED= 102190
# Q3 2022 8.0.0 185766 (mid-quarter typescript conversion)
# Q4 2022 8.0.0 175140
# Q4 2022 9.1.1 179306
readonly BLOCKLY_GZ_SIZE_EXPECTED= 179306
readonly BLOCKLY_GZ_SIZE_EXPECTED=179306

# Size of blocks_compressed.js.gz
# Q2 2019 2.20190722.0 14552
Expand All @@ -91,7 +91,7 @@ readonly BLOCKLY_GZ_SIZE_EXPECTED= 179306
# Q3 2022 8.0.0 17016 (mid-quarter typescript conversion)
# Q4 2022 8.0.0 17188
# Q4 2022 9.1.1 17182
readonly BLOCKS_GZ_SIZE_EXPECTED= 17182
readonly BLOCKS_GZ_SIZE_EXPECTED=17182

# ANSI colors
readonly BOLD_GREEN='\033[1;32m'
Expand Down
8 changes: 4 additions & 4 deletions tests/scripts/update_metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ readonly RELEASE_DIR='dist'
gzip -k "${RELEASE_DIR}/blockly_compressed.js"
gzip -k "${RELEASE_DIR}/blocks_compressed.js"

blockly_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js")
blocks_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js")
blockly_gz_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js.gz")
blocks_gz_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js.gz")
blockly_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js" | xargs)
gonfunko marked this conversation as resolved.
Show resolved Hide resolved
blocks_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js" | xargs)
blockly_gz_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js.gz" | xargs)
blocks_gz_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js.gz" | xargs)
quarters=(1 1 1 2 2 2 3 3 3 4 4 4)
month=$(date +%-m)
quarter=$(echo Q${quarters[$month - 1]} $(date +%Y))
Expand Down