mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
* feat(tests): Add a test script for the renamings file
* Make scripts/migration/renamings.js a valid JSON5 file.
* Add a schema for it in tests/migration/renamings-schema.json.
* Add a script to test one against the other, as
tests/migration/validate-renamings. It is a node.js script
that will exit 0 if the renamings file is valid, or 1 if it
is not (and print a not-very-helpful error message from which
is possible, with some effort, to deduce what the error is.)
* fix: convert to JSON5 and refactor example
* fix: convert keys to new key names
* fix: change versions to arrays instead of objects
* fix: fix version numbers
* fix: associate renames with the version where they were added
* fix: fixup example
* fix: put older renames at the bottom, and newer renames at the top
* fix: enable renamings test in run_all_tests
* fix: put newer renames back at the bottom
This reverts commit efe070e344.
* fix(tests): add missing additionalProperties: false to schema
And fix the resulting validation error in the example entry.
* chore(tests): Improve wording of example entry; add extra examples
Tweaked line wrapping of some existing entries (example and
acutal) that were otherwise untouched.
* feat: add dropDownDiv renaming to new database
* feat(tests): Check for duplicate entries for the same module
Also fixed extraneous whitespace in run_all_tests.sh
* fix(tests): Make validate-renamings.js compatible with node.js v12
Also remove success message, to adhere to usual unix convention
(silence implies success) as eslint does, and reduce unecessary
npm test output clutter.
* fix(tests): Fixes for PR #5980
* Fix typos.
* Remove redundant check.
Co-authored-by: Beka Westberg <bwestberg@google.com>
96 lines
2.6 KiB
Bash
Executable File
96 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ ! -z $CI ]; then echo "Executing run_all_tests.sh from $(pwd)"; fi
|
|
|
|
# ANSI colors
|
|
BOLD_GREEN='\033[1;32m'
|
|
BOLD_RED='\033[1;31m'
|
|
ANSI_RESET='\033[0m'
|
|
|
|
gh_actions_fold () {
|
|
local startOrEnd=$1 # Either "start" or "end"
|
|
|
|
if [ ! -z $CI ]; then
|
|
echo "::$startOrEnd::"
|
|
fi
|
|
}
|
|
|
|
# Find the Blockly project root if pwd is the root
|
|
# or if pwd is the directory containing this script.
|
|
if [ -f ./run_all_tests.js ]; then
|
|
BLOCKLY_ROOT=".."
|
|
elif [ -f tests/run_all_tests.sh ]; then
|
|
BLOCKLY_ROOT="."
|
|
else
|
|
echo -e "${BOLD_RED}ERROR: Cannot determine BLOCKLY_ROOT${ANSI_RESET}" 1>&2;
|
|
exit 1
|
|
fi
|
|
pushd $BLOCKLY_ROOT
|
|
echo "pwd: $(pwd)"
|
|
|
|
FAILURE_COUNT=0
|
|
|
|
run_test_command () {
|
|
local test_id=$1 # The id to use for folds and similar. No spaces.
|
|
local command=$2 # The command to run.
|
|
|
|
echo "======================================="
|
|
echo "== $test_id"
|
|
gh_actions_fold group
|
|
$command
|
|
local test_result=$?
|
|
gh_actions_fold endgroup
|
|
if [ $test_result -eq 0 ]; then
|
|
echo -e "${BOLD_GREEN}SUCCESS:${ANSI_RESET} ${test_id}"
|
|
else
|
|
echo -e "${BOLD_RED}FAILED:${ANSI_RESET} ${test_id}"
|
|
FAILURE_COUNT=$((FAILURE_COUNT+1))
|
|
fi
|
|
}
|
|
|
|
# Lint the codebase.
|
|
# Skip for CI environments, because linting is run separately.
|
|
if [ -z $CI ]; then
|
|
run_test_command "eslint" "eslint ."
|
|
fi
|
|
|
|
# Run the full usual build process, checking to ensure there are no
|
|
# closure compiler warnings / errors.
|
|
run_test_command "build-debug" "npm run build-debug"
|
|
|
|
# Generate TypeScript typings and ensure there are no errors.
|
|
# TODO(5621): Re-enable this test once typings generation is fixed.
|
|
# run_test_command "typings" "npm run typings"
|
|
|
|
# Run renaming validation test.
|
|
run_test_command "renamings" "tests/migration/validate-renamings.js"
|
|
|
|
# Check the sizes of built files for unexpected growth.
|
|
run_test_command "metadata" "tests/scripts/check_metadata.sh"
|
|
|
|
# Run Mocha tests inside a browser.
|
|
run_test_command "mocha" "node tests/mocha/run_mocha_tests_in_browser.js"
|
|
|
|
# Run generator tests inside a browser and check the results.
|
|
run_test_command "generators" "tests/scripts/run_generators.sh"
|
|
|
|
# Run the package build process, as Node tests depend on it.
|
|
run_test_command "package" "npm run package"
|
|
|
|
# Run Node tests.
|
|
run_test_command "node" "./node_modules/.bin/mocha tests/node --config tests/node/.mocharc.js"
|
|
|
|
# Attempt advanced compilation of a Blockly app.
|
|
run_test_command "advanced_compile" "npm run test:compile:advanced"
|
|
|
|
# End of tests.
|
|
popd
|
|
echo "======================================="
|
|
if [ "$FAILURE_COUNT" -eq "0" ]; then
|
|
echo -e "${BOLD_GREEN}All tests passed.${ANSI_RESET}"
|
|
exit 0
|
|
else
|
|
echo -e "${BOLD_RED}Failures in ${FAILURE_COUNT} test groups.${ANSI_RESET}"
|
|
exit 1
|
|
fi
|