mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
refactor(developer): unify test action
This commit is contained in:
parent
21736d8817
commit
70a32f00d7
14 changed files with 46 additions and 200 deletions
|
|
@ -46,24 +46,8 @@ function do_build() {
|
|||
tsc --build
|
||||
}
|
||||
|
||||
function do_test() {
|
||||
local MOCHA_FLAGS=
|
||||
|
||||
if [[ "${TEAMCITY_GIT_PATH:-}" != "" ]]; then
|
||||
# we're running in TeamCity
|
||||
MOCHA_FLAGS="-reporter mocha-teamcity-reporter"
|
||||
fi
|
||||
|
||||
eslint .
|
||||
tsc --build test
|
||||
readonly C8_THRESHOLD=50
|
||||
c8 --reporter=lcov --reporter=text --exclude-after-remap --check-coverage=false --lines $C8_THRESHOLD --statements $C8_THRESHOLD --branches $C8_THRESHOLD --functions $C8_THRESHOLD mocha ${MOCHA_FLAGS}
|
||||
builder_echo warning "Coverage thresholds are currently $C8_THRESHOLD%, which is lower than ideal."
|
||||
builder_echo warning "Please increase threshold in build.sh as test coverage improves."
|
||||
}
|
||||
|
||||
builder_run_action clean rm -rf ./build/
|
||||
builder_run_action configure verify_npm_setup
|
||||
builder_run_action build do_build
|
||||
builder_run_action test do_test
|
||||
builder_run_action test builder_do_typescript_tests 50
|
||||
builder_run_action publish builder_publish_npm
|
||||
|
|
|
|||
|
|
@ -25,25 +25,9 @@ builder_parse "$@"
|
|||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function do_test() {
|
||||
local MOCHA_FLAGS=
|
||||
|
||||
if [[ "${TEAMCITY_GIT_PATH:-}" != "" ]]; then
|
||||
# we're running in TeamCity
|
||||
MOCHA_FLAGS="-reporter mocha-teamcity-reporter"
|
||||
fi
|
||||
|
||||
eslint .
|
||||
cd test
|
||||
tsc --build
|
||||
cd ..
|
||||
readonly C8_THRESHOLD=70
|
||||
c8 --reporter=lcov --reporter=text --lines $C8_THRESHOLD --statements $C8_THRESHOLD --branches $C8_THRESHOLD --functions $C8_THRESHOLD mocha ${MOCHA_FLAGS}
|
||||
}
|
||||
|
||||
builder_run_action clean rm -rf ./build/
|
||||
builder_run_action configure verify_npm_setup
|
||||
builder_run_action build tsc --build
|
||||
builder_run_action api api-extractor run --local --verbose
|
||||
builder_run_action test do_test
|
||||
builder_run_action test builder_do_typescript_tests 70
|
||||
builder_run_action publish builder_publish_npm
|
||||
|
|
|
|||
|
|
@ -29,29 +29,16 @@ builder_parse "$@"
|
|||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
do_test() {
|
||||
# note: `export TEST_SAVE_ARTIFACTS=1` to save a copy of artifacts to temp path
|
||||
# note: `export TEST_SAVE_FIXTURES=1` to get a copy of cloud-based fixtures saved to online/
|
||||
local MOCHA_FLAGS=
|
||||
|
||||
if [[ "${TEAMCITY_GIT_PATH:-}" != "" ]]; then
|
||||
# we're running in TeamCity
|
||||
MOCHA_FLAGS="-reporter mocha-teamcity-reporter"
|
||||
fi
|
||||
|
||||
eslint .
|
||||
cd test
|
||||
tsc --build
|
||||
cd ..
|
||||
readonly C8_THRESHOLD=70
|
||||
c8 -skip-full --reporter=lcov --reporter=text --lines $C8_THRESHOLD --statements $C8_THRESHOLD --branches $C8_THRESHOLD --functions $C8_THRESHOLD mocha ${MOCHA_FLAGS} "${builder_extra_params[@]}"
|
||||
builder_echo warning "Coverage thresholds are currently $C8_THRESHOLD%, which is lower than ideal."
|
||||
builder_echo warning "Please increase threshold in build.sh as test coverage improves."
|
||||
}
|
||||
|
||||
builder_run_action clean rm -rf ./build/
|
||||
builder_run_action configure verify_npm_setup
|
||||
builder_run_action build tsc --build
|
||||
builder_run_action api api-extractor run --local --verbose
|
||||
builder_run_action test do_test
|
||||
|
||||
# note: `export TEST_SAVE_ARTIFACTS=1` to save a copy of artifacts to temp path
|
||||
# note: `export TEST_SAVE_FIXTURES=1` to get a copy of cloud-based fixtures saved to online/
|
||||
# TODO: -skip-full
|
||||
builder_run_action test builder_do_typescript_tests 70
|
||||
|
||||
builder_run_action publish builder_publish_npm
|
||||
|
|
|
|||
|
|
@ -36,24 +36,9 @@ do_build() {
|
|||
cp -R ./src/template/ ./build/src/
|
||||
}
|
||||
|
||||
do_test() {
|
||||
local MOCHA_FLAGS=
|
||||
|
||||
if [[ "${TEAMCITY_GIT_PATH:-}" != "" ]]; then
|
||||
# we're running in TeamCity
|
||||
MOCHA_FLAGS="-reporter mocha-teamcity-reporter"
|
||||
fi
|
||||
|
||||
eslint .
|
||||
cd test
|
||||
tsc --build
|
||||
cd ..
|
||||
c8 --reporter=lcov --reporter=text mocha ${MOCHA_FLAGS} "${builder_extra_params[@]}"
|
||||
}
|
||||
|
||||
builder_run_action clean rm -rf ./build/ ./tsconfig.tsbuildinfo
|
||||
builder_run_action configure verify_npm_setup
|
||||
builder_run_action build do_build
|
||||
builder_run_action api api-extractor run --local --verbose
|
||||
builder_run_action test do_test
|
||||
builder_run_action test builder_do_typescript_tests
|
||||
builder_run_action publish builder_publish_npm
|
||||
|
|
|
|||
|
|
@ -34,26 +34,13 @@ function do_configure() {
|
|||
cat "$KEYMAN_ROOT/resources/standards-data/langtags/langtags.json" >> src/imports/langtags.js
|
||||
}
|
||||
|
||||
function do_test() {
|
||||
local MOCHA_FLAGS=
|
||||
|
||||
if [[ "${TEAMCITY_GIT_PATH:-}" != "" ]]; then
|
||||
# we're running in TeamCity
|
||||
MOCHA_FLAGS="-reporter mocha-teamcity-reporter"
|
||||
fi
|
||||
|
||||
eslint .
|
||||
tsc --build test
|
||||
c8 --reporter=lcov --reporter=text --exclude-after-remap --check-coverage=false mocha ${MOCHA_FLAGS}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
builder_run_action clean rm -rf ./build/ ./tsconfig.tsbuildinfo
|
||||
builder_run_action configure do_configure
|
||||
builder_run_action build tsc --build
|
||||
builder_run_action api api-extractor run --local --verbose
|
||||
builder_run_action test do_test
|
||||
builder_run_action test builder_do_typescript_tests
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -62,20 +62,8 @@ function do_build() {
|
|||
}
|
||||
|
||||
function do_test() {
|
||||
local MOCHA_FLAGS=
|
||||
|
||||
if [[ "${TEAMCITY_GIT_PATH:-}" != "" ]]; then
|
||||
# we're running in TeamCity
|
||||
MOCHA_FLAGS="-reporter mocha-teamcity-reporter"
|
||||
fi
|
||||
|
||||
copy_deps
|
||||
tsc --build test/
|
||||
npm run lint
|
||||
readonly C8_THRESHOLD=80
|
||||
c8 --reporter=lcov --reporter=text --lines $C8_THRESHOLD --statements $C8_THRESHOLD --branches $C8_THRESHOLD --functions $C8_THRESHOLD mocha ${MOCHA_FLAGS}
|
||||
builder_echo warning "Coverage thresholds are currently $C8_THRESHOLD%, which is lower than ideal."
|
||||
builder_echo warning "Please increase threshold in build.sh as test coverage improves."
|
||||
builder_do_typescript_tests 80
|
||||
}
|
||||
|
||||
builder_run_action build do_build
|
||||
|
|
|
|||
|
|
@ -56,27 +56,12 @@ function do_build_fixtures() {
|
|||
node ../../../common/tools/hextobin/build/hextobin.js ./test/fixtures/basic.txt ./build/test/fixtures/basic-txt.kmx
|
||||
}
|
||||
|
||||
function do_test() {
|
||||
local MOCHA_FLAGS=
|
||||
|
||||
if [[ "${TEAMCITY_GIT_PATH:-}" != "" ]]; then
|
||||
# we're running in TeamCity
|
||||
MOCHA_FLAGS="-reporter mocha-teamcity-reporter"
|
||||
fi
|
||||
|
||||
eslint .
|
||||
cd test
|
||||
tsc -b
|
||||
cd ..
|
||||
c8 --reporter=lcov --reporter=text mocha ${MOCHA_FLAGS} "${builder_extra_params[@]}"
|
||||
}
|
||||
|
||||
builder_run_action clean do_clean
|
||||
builder_run_action configure do_configure
|
||||
builder_run_action build do_build
|
||||
builder_run_action build-fixtures do_build_fixtures
|
||||
builder_run_action api api-extractor run --local --verbose
|
||||
builder_run_action test do_test
|
||||
builder_run_action test builder_do_typescript_tests
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -27,43 +27,11 @@ builder_parse "$@"
|
|||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
if builder_start_action clean; then
|
||||
rm -rf ./build/ ./tsconfig.tsbuildinfo
|
||||
builder_finish_action success clean
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
if builder_start_action configure; then
|
||||
verify_npm_setup
|
||||
builder_finish_action success configure
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
if builder_start_action build; then
|
||||
npm run build
|
||||
builder_finish_action success build
|
||||
fi
|
||||
|
||||
builder_run_action api api-extractor run --local --verbose
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function do_test() {
|
||||
local MOCHA_FLAGS=
|
||||
|
||||
if [[ "${TEAMCITY_GIT_PATH:-}" != "" ]]; then
|
||||
# we're running in TeamCity
|
||||
MOCHA_FLAGS="-reporter mocha-teamcity-reporter"
|
||||
fi
|
||||
eslint .
|
||||
tsc --build test
|
||||
c8 --reporter=lcov --reporter=text --exclude-after-remap --check-coverage=false --lines 80 mocha ${MOCHA_FLAGS}
|
||||
# TODO: remove --lines 80 and improve coverage
|
||||
}
|
||||
|
||||
builder_run_action test do_test
|
||||
builder_run_action clean rm -rf ./build/ ./tsconfig.tsbuildinfo
|
||||
builder_run_action configure verify_npm_setup
|
||||
builder_run_action build tsc --build
|
||||
builder_run_action api api-extractor run --local --verbose
|
||||
builder_run_action test builder_do_typescript_tests 80
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
"url": "https://github.com/keymanapp/keyman/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@keymanapp/common-types": "*",
|
||||
"@keymanapp/common-types": "*",
|
||||
"@keymanapp/developer-utils": "*"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -32,27 +32,13 @@ builder_parse "$@"
|
|||
|
||||
function do_build() {
|
||||
tsc -b ./tools/tsconfig.json
|
||||
npm run build
|
||||
}
|
||||
|
||||
function do_test() {
|
||||
local MOCHA_FLAGS=
|
||||
|
||||
if [[ "${TEAMCITY_GIT_PATH:-}" != "" ]]; then
|
||||
# we're running in TeamCity
|
||||
MOCHA_FLAGS="-reporter mocha-teamcity-reporter"
|
||||
fi
|
||||
npm run lint
|
||||
cd test
|
||||
tsc -b
|
||||
cd ..
|
||||
c8 --reporter=lcov --reporter=text mocha ${MOCHA_FLAGS}
|
||||
}
|
||||
|
||||
builder_run_action clean rm -rf ./build/ ./tsconfig.tsbuildinfo
|
||||
builder_run_action configure verify_npm_setup
|
||||
builder_run_action build do_build
|
||||
builder_run_action api api-extractor run --local --verbose
|
||||
builder_run_action test do_test
|
||||
builder_run_action test builder_do_typescript_tests
|
||||
builder_run_action publish builder_publish_npm
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
"dependencies": {
|
||||
"@keymanapp/common-types": "*",
|
||||
"@keymanapp/keyman-version": "*",
|
||||
"@keymanapp/common-types": "*",
|
||||
"typescript": "^5.4.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -30,25 +30,11 @@ builder_describe_outputs \
|
|||
|
||||
builder_parse "$@"
|
||||
|
||||
function do_test() {
|
||||
local MOCHA_FLAGS=
|
||||
|
||||
if [[ "${TEAMCITY_GIT_PATH:-}" != "" ]]; then
|
||||
# we're running in TeamCity
|
||||
MOCHA_FLAGS="-reporter mocha-teamcity-reporter"
|
||||
fi
|
||||
eslint .
|
||||
cd test
|
||||
tsc --build
|
||||
cd ..
|
||||
c8 --reporter=lcov --reporter=text mocha ${MOCHA_FLAGS}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
builder_run_action clean rm -rf ./build/ ./tsconfig.tsbuildinfo
|
||||
builder_run_action configure verify_npm_setup
|
||||
builder_run_action build tsc --build
|
||||
builder_run_action api api-extractor run --local --verbose
|
||||
builder_run_action test do_test
|
||||
builder_run_action test builder_do_typescript_tests
|
||||
builder_run_action publish builder_publish_npm
|
||||
|
|
|
|||
|
|
@ -61,24 +61,6 @@ function do_api() {
|
|||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function do_test() {
|
||||
local MOCHA_FLAGS=
|
||||
|
||||
if [[ "${TEAMCITY_GIT_PATH:-}" != "" ]]; then
|
||||
# we're running in TeamCity
|
||||
MOCHA_FLAGS="-reporter mocha-teamcity-reporter"
|
||||
fi
|
||||
|
||||
eslint .
|
||||
tsc --build test/
|
||||
readonly C8_THRESHOLD=50
|
||||
c8 --reporter=lcov --reporter=text --lines $C8_THRESHOLD --statements $C8_THRESHOLD --branches $C8_THRESHOLD --functions $C8_THRESHOLD mocha ${MOCHA_FLAGS}
|
||||
builder_echo warning "Coverage thresholds are currently $C8_THRESHOLD%, which is lower than ideal."
|
||||
builder_echo warning "Please increase threshold in build.sh as test coverage improves."
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function do_bundle() {
|
||||
SOURCEMAP_PATHS=( "${PACKAGES[@]}" )
|
||||
SOURCEMAP_PATHS=( "${SOURCEMAP_PATHS[@]/%//build}" )
|
||||
|
|
@ -117,7 +99,7 @@ function do_bundle() {
|
|||
builder_run_action clean rm -rf ./build/ ./tsconfig.tsbuildinfo
|
||||
builder_run_action configure verify_npm_setup
|
||||
builder_run_action build do_build
|
||||
builder_run_action test do_test
|
||||
builder_run_action test builder_do_typescript_tests 50
|
||||
builder_run_action api do_api
|
||||
builder_run_action bundle do_bundle
|
||||
builder_run_action publish builder_publish_npm
|
||||
|
|
|
|||
|
|
@ -304,4 +304,30 @@ _select_node_version_with_nvm() {
|
|||
|
||||
check-markdown() {
|
||||
node "$KEYMAN_ROOT/resources/tools/check-markdown" --root "$1"
|
||||
}
|
||||
|
||||
builder_do_typescript_tests() {
|
||||
local MOCHA_FLAGS=
|
||||
|
||||
if [[ "${TEAMCITY_GIT_PATH:-}" != "" ]]; then
|
||||
# we're running in TeamCity
|
||||
MOCHA_FLAGS="-reporter mocha-teamcity-reporter"
|
||||
fi
|
||||
|
||||
eslint .
|
||||
tsc --build test/
|
||||
|
||||
local THRESHOLD_PARAMS=
|
||||
local C8_THRESHOLD=
|
||||
if [[ $# -gt 0 ]]; then
|
||||
C8_THRESHOLD=$1
|
||||
THRESHOLD_PARAMS="--lines $C8_THRESHOLD --statements $C8_THRESHOLD --branches $C8_THRESHOLD --functions $C8_THRESHOLD"
|
||||
fi
|
||||
|
||||
c8 --reporter=lcov --reporter=text --exclude-after-remap --check-coverage=false $THRESHOLD_PARAMS mocha ${MOCHA_FLAGS} "${builder_extra_params[@]}"
|
||||
|
||||
if [[ ! -z "$C8_THRESHOLD" ]]; then
|
||||
builder_echo warning "Coverage thresholds are currently $C8_THRESHOLD%, which is lower than ideal."
|
||||
builder_echo warning "Please increase threshold in build.sh as test coverage improves."
|
||||
fi
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue