From c27ac9e4be8d5f5c07fd106960694f5c3526b30c Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Tue, 26 Nov 2024 19:14:16 +0100 Subject: [PATCH 1/2] chore(common): rename test files This change rename the test files in Common according to the discussion at the Keyman conference in November 2024. --- common/web/types/package.json | 2 +- .../kmx/{test-keyman-targets.ts => keyman-targets.tests.ts} | 0 .../web/types/test/kmx/{test-kmx-file.ts => kmx-file.tests.ts} | 0 .../web/types/test/kvk/{test-kvk-file.ts => kvk-file.tests.ts} | 2 +- .../types/test/kvk/{test-kvk-utils.ts => kvk-utils.tests.ts} | 0 .../{test-pattern-parser.ts => pattern-parser.tests.ts} | 0 .../ldml-keyboard/{test-string-list.ts => string-list.tests.ts} | 0 common/web/types/test/tsconfig.json | 1 - .../web/types/test/util/{test-unescape.ts => unescape.tests.ts} | 0 9 files changed, 2 insertions(+), 3 deletions(-) rename common/web/types/test/kmx/{test-keyman-targets.ts => keyman-targets.tests.ts} (100%) rename common/web/types/test/kmx/{test-kmx-file.ts => kmx-file.tests.ts} (100%) rename common/web/types/test/kvk/{test-kvk-file.ts => kvk-file.tests.ts} (90%) rename common/web/types/test/kvk/{test-kvk-utils.ts => kvk-utils.tests.ts} (100%) rename common/web/types/test/ldml-keyboard/{test-pattern-parser.ts => pattern-parser.tests.ts} (100%) rename common/web/types/test/ldml-keyboard/{test-string-list.ts => string-list.tests.ts} (100%) rename common/web/types/test/util/{test-unescape.ts => unescape.tests.ts} (100%) diff --git a/common/web/types/package.json b/common/web/types/package.json index e9f7c412947..f78557cb524 100644 --- a/common/web/types/package.json +++ b/common/web/types/package.json @@ -48,7 +48,7 @@ "typescript": "^5.4.5" }, "mocha": { - "spec": "build/test/**/test-*.js", + "spec": "build/test/**/*.tests.js", "require": [ "source-map-support/register" ] diff --git a/common/web/types/test/kmx/test-keyman-targets.ts b/common/web/types/test/kmx/keyman-targets.tests.ts similarity index 100% rename from common/web/types/test/kmx/test-keyman-targets.ts rename to common/web/types/test/kmx/keyman-targets.tests.ts diff --git a/common/web/types/test/kmx/test-kmx-file.ts b/common/web/types/test/kmx/kmx-file.tests.ts similarity index 100% rename from common/web/types/test/kmx/test-kmx-file.ts rename to common/web/types/test/kmx/kmx-file.tests.ts diff --git a/common/web/types/test/kvk/test-kvk-file.ts b/common/web/types/test/kvk/kvk-file.tests.ts similarity index 90% rename from common/web/types/test/kvk/test-kvk-file.ts rename to common/web/types/test/kvk/kvk-file.tests.ts index 8a1179b67b2..8e0387fefe3 100644 --- a/common/web/types/test/kvk/test-kvk-file.ts +++ b/common/web/types/test/kvk/kvk-file.tests.ts @@ -2,7 +2,7 @@ import * as fs from 'fs'; import 'mocha'; import { makePathToFixture } from '../helpers/index.js'; import KvkFileReader from "../../src/kvk/kvk-file-reader.js"; -import { verify_balochi_inpage, verify_khmer_angkor } from './test-kvk-utils.js'; +import { verify_balochi_inpage, verify_khmer_angkor } from './kvk-utils.tests.js'; describe('kvk-file-reader', function () { it('kvk-file-reader should read a valid file', function() { diff --git a/common/web/types/test/kvk/test-kvk-utils.ts b/common/web/types/test/kvk/kvk-utils.tests.ts similarity index 100% rename from common/web/types/test/kvk/test-kvk-utils.ts rename to common/web/types/test/kvk/kvk-utils.tests.ts diff --git a/common/web/types/test/ldml-keyboard/test-pattern-parser.ts b/common/web/types/test/ldml-keyboard/pattern-parser.tests.ts similarity index 100% rename from common/web/types/test/ldml-keyboard/test-pattern-parser.ts rename to common/web/types/test/ldml-keyboard/pattern-parser.tests.ts diff --git a/common/web/types/test/ldml-keyboard/test-string-list.ts b/common/web/types/test/ldml-keyboard/string-list.tests.ts similarity index 100% rename from common/web/types/test/ldml-keyboard/test-string-list.ts rename to common/web/types/test/ldml-keyboard/string-list.tests.ts diff --git a/common/web/types/test/tsconfig.json b/common/web/types/test/tsconfig.json index 9678c49945f..21b4145e594 100644 --- a/common/web/types/test/tsconfig.json +++ b/common/web/types/test/tsconfig.json @@ -10,7 +10,6 @@ "allowSyntheticDefaultImports": true }, "include": [ - "**/test-*.ts", "**/*.tests.ts", "./helpers/*.ts", ], diff --git a/common/web/types/test/util/test-unescape.ts b/common/web/types/test/util/unescape.tests.ts similarity index 100% rename from common/web/types/test/util/test-unescape.ts rename to common/web/types/test/util/unescape.tests.ts From cbbb643ed02a4070c7138705c08f347cf9911f38 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Tue, 3 Dec 2024 13:53:13 +0100 Subject: [PATCH 2/2] chore(common): rename `common/web/types/test` to `.../tests` Addresses code review comment. --- common/web/types/.eslintrc.cjs | 4 ++-- common/web/types/build.sh | 2 +- common/web/types/package.json | 6 +++--- .../{test => tests}/fixtures/kmx/khmer_angkor.kmx | Bin .../{test => tests}/fixtures/kvk/balochi_inpage.kvk | Bin .../{test => tests}/fixtures/kvk/khmer_angkor.kvk | Bin common/web/types/{test => tests}/helpers/index.ts | 2 +- .../{test => tests}/kmx/keyman-targets.tests.ts | 0 .../web/types/{test => tests}/kmx/kmx-file.tests.ts | 0 .../web/types/{test => tests}/kvk/kvk-file.tests.ts | 0 .../types/{test => tests}/kvk/kvk-utils.tests.ts | 0 .../ldml-keyboard/pattern-parser.tests.ts | 0 .../ldml-keyboard/string-list.tests.ts | 0 .../{test => tests}/lexical-model-types.tests.ts | 0 common/web/types/{test => tests}/tsconfig.json | 2 +- .../types/{test => tests}/util/unescape.tests.ts | 0 16 files changed, 8 insertions(+), 8 deletions(-) rename common/web/types/{test => tests}/fixtures/kmx/khmer_angkor.kmx (100%) rename common/web/types/{test => tests}/fixtures/kvk/balochi_inpage.kvk (100%) rename common/web/types/{test => tests}/fixtures/kvk/khmer_angkor.kvk (100%) rename common/web/types/{test => tests}/helpers/index.ts (87%) rename common/web/types/{test => tests}/kmx/keyman-targets.tests.ts (100%) rename common/web/types/{test => tests}/kmx/kmx-file.tests.ts (100%) rename common/web/types/{test => tests}/kvk/kvk-file.tests.ts (100%) rename common/web/types/{test => tests}/kvk/kvk-utils.tests.ts (100%) rename common/web/types/{test => tests}/ldml-keyboard/pattern-parser.tests.ts (100%) rename common/web/types/{test => tests}/ldml-keyboard/string-list.tests.ts (100%) rename common/web/types/{test => tests}/lexical-model-types.tests.ts (100%) rename common/web/types/{test => tests}/tsconfig.json (93%) rename common/web/types/{test => tests}/util/unescape.tests.ts (100%) diff --git a/common/web/types/.eslintrc.cjs b/common/web/types/.eslintrc.cjs index b28ba0941b1..4fd5954e495 100644 --- a/common/web/types/.eslintrc.cjs +++ b/common/web/types/.eslintrc.cjs @@ -1,13 +1,13 @@ module.exports = { parserOptions: { - project: ["./tsconfig.json", "./test/tsconfig.json"], + project: ["./tsconfig.json", "./tests/tsconfig.json"], }, ignorePatterns: [ ".*/*", "build/*", "coverage/*", "node_modules/*", - "test/fixtures/*", + "tests/fixtures/*", "tools/*", "src/schemas/*" ], diff --git a/common/web/types/build.sh b/common/web/types/build.sh index 75273aaa2c9..418840d1a85 100755 --- a/common/web/types/build.sh +++ b/common/web/types/build.sh @@ -88,7 +88,7 @@ function do_test() { fi eslint . - tsc --build test + tsc --build tests readonly C8_THRESHOLD=60 diff --git a/common/web/types/package.json b/common/web/types/package.json index f78557cb524..d6efc635039 100644 --- a/common/web/types/package.json +++ b/common/web/types/package.json @@ -23,7 +23,7 @@ "build": "tsc -b", "build:schema": "ajv compile", "lint": "eslint .", - "test": "npm run lint && cd test && tsc -b && cd .. && c8 --skip-full --reporter=lcov --reporter=text mocha" + "test": "npm run lint && cd tests && tsc -b && cd .. && c8 --skip-full --reporter=lcov --reporter=text mocha" }, "author": "Marc Durdin (https://github.com/mcdurdin)", "license": "MIT", @@ -48,7 +48,7 @@ "typescript": "^5.4.5" }, "mocha": { - "spec": "build/test/**/*.tests.js", + "spec": "build/tests/**/*.tests.js", "require": [ "source-map-support/register" ] @@ -76,7 +76,7 @@ "src/keyman-touch-layout/keyman-touch-layout-file-writer.ts", "src/osk/osk.ts", "src/schemas/*", - "test/" + "tests/" ] }, "sideEffects": false diff --git a/common/web/types/test/fixtures/kmx/khmer_angkor.kmx b/common/web/types/tests/fixtures/kmx/khmer_angkor.kmx similarity index 100% rename from common/web/types/test/fixtures/kmx/khmer_angkor.kmx rename to common/web/types/tests/fixtures/kmx/khmer_angkor.kmx diff --git a/common/web/types/test/fixtures/kvk/balochi_inpage.kvk b/common/web/types/tests/fixtures/kvk/balochi_inpage.kvk similarity index 100% rename from common/web/types/test/fixtures/kvk/balochi_inpage.kvk rename to common/web/types/tests/fixtures/kvk/balochi_inpage.kvk diff --git a/common/web/types/test/fixtures/kvk/khmer_angkor.kvk b/common/web/types/tests/fixtures/kvk/khmer_angkor.kvk similarity index 100% rename from common/web/types/test/fixtures/kvk/khmer_angkor.kvk rename to common/web/types/tests/fixtures/kvk/khmer_angkor.kvk diff --git a/common/web/types/test/helpers/index.ts b/common/web/types/tests/helpers/index.ts similarity index 87% rename from common/web/types/test/helpers/index.ts rename to common/web/types/tests/helpers/index.ts index 3e305eeca8a..717b2e75191 100644 --- a/common/web/types/test/helpers/index.ts +++ b/common/web/types/tests/helpers/index.ts @@ -9,5 +9,5 @@ import { fileURLToPath } from "url"; * @param components One or more path components. */ export function makePathToFixture(...components: string[]): string { - return fileURLToPath(new URL(path.join('..', '..', '..', 'test', 'fixtures', ...components), import.meta.url)); + return fileURLToPath(new URL(path.join('..', '..', '..', 'tests', 'fixtures', ...components), import.meta.url)); } diff --git a/common/web/types/test/kmx/keyman-targets.tests.ts b/common/web/types/tests/kmx/keyman-targets.tests.ts similarity index 100% rename from common/web/types/test/kmx/keyman-targets.tests.ts rename to common/web/types/tests/kmx/keyman-targets.tests.ts diff --git a/common/web/types/test/kmx/kmx-file.tests.ts b/common/web/types/tests/kmx/kmx-file.tests.ts similarity index 100% rename from common/web/types/test/kmx/kmx-file.tests.ts rename to common/web/types/tests/kmx/kmx-file.tests.ts diff --git a/common/web/types/test/kvk/kvk-file.tests.ts b/common/web/types/tests/kvk/kvk-file.tests.ts similarity index 100% rename from common/web/types/test/kvk/kvk-file.tests.ts rename to common/web/types/tests/kvk/kvk-file.tests.ts diff --git a/common/web/types/test/kvk/kvk-utils.tests.ts b/common/web/types/tests/kvk/kvk-utils.tests.ts similarity index 100% rename from common/web/types/test/kvk/kvk-utils.tests.ts rename to common/web/types/tests/kvk/kvk-utils.tests.ts diff --git a/common/web/types/test/ldml-keyboard/pattern-parser.tests.ts b/common/web/types/tests/ldml-keyboard/pattern-parser.tests.ts similarity index 100% rename from common/web/types/test/ldml-keyboard/pattern-parser.tests.ts rename to common/web/types/tests/ldml-keyboard/pattern-parser.tests.ts diff --git a/common/web/types/test/ldml-keyboard/string-list.tests.ts b/common/web/types/tests/ldml-keyboard/string-list.tests.ts similarity index 100% rename from common/web/types/test/ldml-keyboard/string-list.tests.ts rename to common/web/types/tests/ldml-keyboard/string-list.tests.ts diff --git a/common/web/types/test/lexical-model-types.tests.ts b/common/web/types/tests/lexical-model-types.tests.ts similarity index 100% rename from common/web/types/test/lexical-model-types.tests.ts rename to common/web/types/tests/lexical-model-types.tests.ts diff --git a/common/web/types/test/tsconfig.json b/common/web/types/tests/tsconfig.json similarity index 93% rename from common/web/types/test/tsconfig.json rename to common/web/types/tests/tsconfig.json index 21b4145e594..45e5311fdc0 100644 --- a/common/web/types/test/tsconfig.json +++ b/common/web/types/tests/tsconfig.json @@ -4,7 +4,7 @@ "compilerOptions": { "rootDir": ".", "rootDirs": ["./", "../src/"], - "outDir": "../build/test", + "outDir": "../build/tests", "baseUrl": ".", "strictNullChecks": false, // TODO: get rid of this as some point "allowSyntheticDefaultImports": true diff --git a/common/web/types/test/util/unescape.tests.ts b/common/web/types/tests/util/unescape.tests.ts similarity index 100% rename from common/web/types/test/util/unescape.tests.ts rename to common/web/types/tests/util/unescape.tests.ts