From 13476d48c847d9d90ee2c1adc2a9bb9d45909a46 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Thu, 6 Jun 2024 15:48:58 +0700 Subject: [PATCH] change(web): precompile all TS-based tests --- web/common.inc.sh | 10 +++++-- web/src/engine/osk/build.sh | 2 +- .../{activation.js => activation.tests.ts} | 0 ...{lengthStyles.js => lengthStyles.tests.ts} | 1 - web/test.sh | 26 ------------------- 5 files changed, 9 insertions(+), 30 deletions(-) rename web/src/test/auto/headless/engine/osk/{activation.js => activation.tests.ts} (100%) rename web/src/test/auto/headless/engine/osk/{lengthStyles.js => lengthStyles.tests.ts} (99%) diff --git a/web/common.inc.sh b/web/common.inc.sh index 83060675f78..9457fa5a416 100644 --- a/web/common.inc.sh +++ b/web/common.inc.sh @@ -85,8 +85,14 @@ function prepare() { # ``` function test-headless() { TEST_FOLDER=$1 - TEST_EXTENSIONS=${2:-} TEST_BASE="${KEYMAN_ROOT}/web/src/test/auto/headless/" + TEST_EXTENSIONS=${2:-} + if [ ! -z "${2:-}" ]; then + TEST_BASE="${KEYMAN_ROOT}/web/build/test/headless/" + + # Ensure the compiled tests are available. + tsc --project "${KEYMAN_ROOT}/web/src/test/auto/tsconfig.json" + fi TEST_OPTS= TEST_CD_REQD=false @@ -135,5 +141,5 @@ function test-headless() { function test-headless-typescript() { # tests.js - ensure any plain-js files that exist as test resources, but not test defs, # aren't treated by Mocha as tests. - test-headless "$1" "tests.ts" + test-headless "$1" "tests.js" } diff --git a/web/src/engine/osk/build.sh b/web/src/engine/osk/build.sh index 12bcc529978..8b0d8ae75e4 100755 --- a/web/src/engine/osk/build.sh +++ b/web/src/engine/osk/build.sh @@ -53,4 +53,4 @@ do_build() { builder_run_action configure do_configure builder_run_action clean rm -rf "${KEYMAN_ROOT}/web/build/${SUBPROJECT_NAME}" builder_run_action build do_build -builder_run_action test test-headless "${SUBPROJECT_NAME}" \ No newline at end of file +builder_run_action test test-headless-typescript "${SUBPROJECT_NAME}" \ No newline at end of file diff --git a/web/src/test/auto/headless/engine/osk/activation.js b/web/src/test/auto/headless/engine/osk/activation.tests.ts similarity index 100% rename from web/src/test/auto/headless/engine/osk/activation.js rename to web/src/test/auto/headless/engine/osk/activation.tests.ts diff --git a/web/src/test/auto/headless/engine/osk/lengthStyles.js b/web/src/test/auto/headless/engine/osk/lengthStyles.tests.ts similarity index 99% rename from web/src/test/auto/headless/engine/osk/lengthStyles.js rename to web/src/test/auto/headless/engine/osk/lengthStyles.tests.ts index fc6222a9d45..296e5094c7d 100644 --- a/web/src/test/auto/headless/engine/osk/lengthStyles.js +++ b/web/src/test/auto/headless/engine/osk/lengthStyles.tests.ts @@ -1,5 +1,4 @@ import { assert } from 'chai'; -import sinon from 'sinon'; import { ParsedLengthStyle } from 'keyman/engine/osk'; diff --git a/web/test.sh b/web/test.sh index e3cbaef60f6..12216512c93 100755 --- a/web/test.sh +++ b/web/test.sh @@ -27,32 +27,6 @@ builder_parse "$@" # Browser-based tests: common configs & kill-switches -# DO_BROWSER_TEST_SUITE=true - -# if [[ $VERSION_ENVIRONMENT == test ]]; then -# # Implied: CONFIG=CI.conf.js because `-CI` parameter is passed. -# # -# # If we are running a TeamCity test build, for now, only run BrowserStack -# # tests when on a PR branch with a title including "(web)" or with the label -# # test-browserstack. This is because the BrowserStack tests are currently -# # unreliable, and the false positive failures are masking actual failures. -# # -# # We do not run BrowserStack tests on master, beta, or stable-x.y test -# # builds. -# DO_BROWSER_TEST_SUITE=false -# if builder_pull_get_details; then -# if [[ $builder_pull_title =~ \(web\) ]] || builder_pull_has_label test-browserstack; then -# DO_BROWSER_TEST_SUITE=true -# fi -# fi -# fi - -# if [[ $DO_BROWSER_TEST_SUITE == false ]]; then -# builder_warn "Skipping action test:engine - this CI build does not appear to be for a Web PR." -# builder_finish_action success test:engine -# exit 0 -# fi - # Select the right CONFIG file. WTR_CONFIG= if builder_has_option --ci; then