diff --git a/common/web/types/package.json b/common/web/types/package.json index 4c2e2bfd2e..2b2122f682 100644 --- a/common/web/types/package.json +++ b/common/web/types/package.json @@ -36,8 +36,6 @@ "restructure": "3.0.1" }, "devDependencies": { - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "ajv": "^8.12.0", "ajv-cli": "^5.0.0", "ajv-formats": "^2.1.1", diff --git a/developer/src/common/web/test-helpers/TestCompilerCallbacks.ts b/developer/src/common/web/test-helpers/TestCompilerCallbacks.ts index 04e5734f18..711944f12d 100644 --- a/developer/src/common/web/test-helpers/TestCompilerCallbacks.ts +++ b/developer/src/common/web/test-helpers/TestCompilerCallbacks.ts @@ -5,6 +5,7 @@ import { CompilerEvent, CompilerCallbacks, CompilerPathCallbacks, CompilerFileSy CompilerFileSystemAsyncCallbacks, CompilerErrorSeverity} from '@keymanapp/developer-utils'; import { fileURLToPath } from 'url'; +import { Suite } from 'mocha'; const { TEST_SAVE_FIXTURES } = process.env; @@ -12,16 +13,27 @@ const { TEST_SAVE_FIXTURES } = process.env; * A CompilerCallbacks implementation for testing */ export class TestCompilerCallbacks implements CompilerCallbacks { - /* TestCompilerCallbacks */ - + private readonly suite: Suite; messages: CompilerEvent[] = []; readonly _net: TestCompilerNetAsyncCallbacks; readonly _fsAsync: DefaultCompilerFileSystemAsyncCallbacks = new DefaultCompilerFileSystemAsyncCallbacks(this); - constructor(basePath?: string) { + constructor(suite?: Suite, basePath?: string) { if(basePath) { this._net = new TestCompilerNetAsyncCallbacks(basePath); } + this.suite = suite; + if(this.suite) { + const _this = this; + this.suite.beforeEach(function() { + _this.clear(); + }); + this.suite.afterEach(function() { + if(this.currentTest?.isFailed()) { + _this.printMessages(); + } + }) + } } clear() { @@ -55,7 +67,7 @@ export class TestCompilerCallbacks implements CompilerCallbacks { loadFile(filename: string): Uint8Array { try { - return fs.readFileSync(filename); + return fs.readFileSync(filename) as Uint8Array; } catch(e) { if (e.code === 'ENOENT') { return null; @@ -162,7 +174,7 @@ class TestCompilerNetAsyncCallbacks implements CompilerNetAsyncCallbacks { // missing file, this is okay return null; } - const data: Uint8Array = fs.readFileSync(p); + const data = fs.readFileSync(p) as Uint8Array; return data; } diff --git a/developer/src/common/web/utils/test/kpj/kpj-file-reader.tests.ts b/developer/src/common/web/utils/test/kpj/kpj-file-reader.tests.ts index 358edb01da..a70d4dd42c 100644 --- a/developer/src/common/web/utils/test/kpj/kpj-file-reader.tests.ts +++ b/developer/src/common/web/utils/test/kpj/kpj-file-reader.tests.ts @@ -6,13 +6,15 @@ import { KPJFileReader } from "../../src/types/kpj/kpj-file-reader.js"; import { KeymanDeveloperProjectFile10, KeymanDeveloperProjectType } from '../../src/types/kpj/keyman-developer-project.js'; import { TestCompilerCallbacks } from '@keymanapp/developer-test-helpers'; -const callbacks = new TestCompilerCallbacks(); describe('kpj-file-reader', function () { + + const callbacks = new TestCompilerCallbacks(this); + it('kpj-file-reader should read a valid file', async function() { const kpjPath = 'khmer_angkor.kpj'; const path = makePathToFixture('kpj', kpjPath); - const input = fs.readFileSync(path); + const input = fs.readFileSync(path) as Uint8Array; const reader = new KPJFileReader(callbacks); const kpj = reader.read(input); reader.validate(kpj); @@ -124,7 +126,7 @@ describe('kpj-file-reader', function () { it('should load a v1.0 keyboard project with missing ', async function() { const path = makePathToFixture('kpj', 'project-missing-file', 'project_missing_file.kpj'); - const input = fs.readFileSync(path); + const input = fs.readFileSync(path) as Uint8Array; const reader = new KPJFileReader(callbacks); const kpj = reader.read(input); reader.validate(kpj); @@ -140,7 +142,7 @@ describe('kpj-file-reader', function () { it('should load a v1.0 keyboard project with missing ', async function() { const path = makePathToFixture('kpj', 'project-missing-file', 'project_missing_files.kpj'); - const input = fs.readFileSync(path); + const input = fs.readFileSync(path) as Uint8Array; const reader = new KPJFileReader(callbacks); const kpj = reader.read(input); reader.validate(kpj); diff --git a/developer/src/kmc-analyze/package.json b/developer/src/kmc-analyze/package.json index c7e2ebabe2..432bb26e01 100644 --- a/developer/src/kmc-analyze/package.json +++ b/developer/src/kmc-analyze/package.json @@ -29,8 +29,6 @@ }, "devDependencies": { "@keymanapp/resources-gosh": "*", - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "c8": "^7.12.0", "chalk": "^2.4.2", "typescript": "^5.4.5" diff --git a/developer/src/kmc-copy/test/copier-messages.tests.ts b/developer/src/kmc-copy/test/copier-messages.tests.ts index 0312910860..ea0e9bf624 100644 --- a/developer/src/kmc-copy/test/copier-messages.tests.ts +++ b/developer/src/kmc-copy/test/copier-messages.tests.ts @@ -14,17 +14,7 @@ import { KeymanProjectCopier } from '../src/KeymanProjectCopier.js'; import { makePathToFixture } from './helpers/index.js'; describe('CopierMessages', function () { - const callbacks = new TestCompilerCallbacks(makePathToFixture('online')); - - this.beforeEach(function() { - callbacks.clear(); - }); - - this.afterEach(function() { - if(this.currentTest?.isFailed()) { - callbacks.printMessages(); - } - }); + const callbacks = new TestCompilerCallbacks(this, makePathToFixture('online')); it('should have a valid CopierMessages object', function() { return verifyCompilerMessagesObject(CopierMessages, CompilerErrorNamespace.Copier); diff --git a/developer/src/kmc-copy/test/copier.tests.ts b/developer/src/kmc-copy/test/copier.tests.ts index 697e58e0b5..2acf5bf12c 100644 --- a/developer/src/kmc-copy/test/copier.tests.ts +++ b/developer/src/kmc-copy/test/copier.tests.ts @@ -23,7 +23,7 @@ function normalizeNewLine(s: string): string { } describe('KeymanProjectCopier', function() { - const callbacks = new TestCompilerCallbacks(makePathToFixture('online')); + const callbacks = new TestCompilerCallbacks(this, makePathToFixture('online')); this.beforeAll(function() { if(TEST_SAVE_ARTIFACTS) { @@ -32,16 +32,6 @@ describe('KeymanProjectCopier', function() { } }); - this.beforeEach(function() { - callbacks.clear(); - }); - - this.afterEach(function() { - if(this.currentTest?.isFailed()) { - callbacks.printMessages(); - } - }); - const tests = [ // diff --git a/developer/src/kmc-generate/test/lexical-model-generator.tests.ts b/developer/src/kmc-generate/test/lexical-model-generator.tests.ts index 39908f25c9..f54dc5290c 100644 --- a/developer/src/kmc-generate/test/lexical-model-generator.tests.ts +++ b/developer/src/kmc-generate/test/lexical-model-generator.tests.ts @@ -35,6 +35,8 @@ function getFilenames(p: string, base?: string): string[] { describe('LexicalModelGenerator', function () { let clock: sinon.SinonFakeTimers; + const callbacks = new TestCompilerCallbacks(this); + before(function() { // We will always be 12 April 2024 to match test fixtures clock = sinon.useFakeTimers(new Date(2024, 3, 12)); @@ -46,7 +48,6 @@ describe('LexicalModelGenerator', function () { it('should generate a lexical model from provided options', async function() { const generator = new LexicalModelGenerator(); - const callbacks = new TestCompilerCallbacks(); const opts: GeneratorOptions = {...options}; opts.id = 'sample.en.sample'; opts.targets = [KeymanTargets.KeymanTarget.any]; diff --git a/developer/src/kmc-keyboard-info/package.json b/developer/src/kmc-keyboard-info/package.json index 5b0c463b3a..db256a6c78 100644 --- a/developer/src/kmc-keyboard-info/package.json +++ b/developer/src/kmc-keyboard-info/package.json @@ -29,8 +29,6 @@ "@keymanapp/langtags": "*" }, "devDependencies": { - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "c8": "^7.12.0", "chalk": "^2.4.2", "typescript": "^5.4.5" diff --git a/developer/src/kmc-keyboard-info/test/keyboard-info-compiler-messages.tests.ts b/developer/src/kmc-keyboard-info/test/keyboard-info-compiler-messages.tests.ts index fcd9dfb8c1..7bb355faef 100644 --- a/developer/src/kmc-keyboard-info/test/keyboard-info-compiler-messages.tests.ts +++ b/developer/src/kmc-keyboard-info/test/keyboard-info-compiler-messages.tests.ts @@ -8,8 +8,6 @@ import { makePathToFixture } from './helpers/index.js'; import { KeyboardInfoCompiler } from '../src/keyboard-info-compiler.js'; import { KeyboardInfoFile } from '../src/keyboard-info-file.js'; -const callbacks = new TestCompilerCallbacks(); - const KHMER_ANGKOR_JS = makePathToFixture('khmer_angkor', 'build', 'khmer_angkor.js'); const KHMER_ANGKOR_KPS = makePathToFixture('khmer_angkor', 'source', 'khmer_angkor.kps'); const KHMER_ANGKOR_KMP = makePathToFixture('khmer_angkor', 'build', 'khmer_angkor.kmp'); @@ -24,15 +22,7 @@ const KHMER_ANGKOR_SOURCES = { describe('KeyboardInfoCompilerMessages', function () { - this.beforeEach(function() { - callbacks.clear(); - }); - - this.afterEach(function() { - if(this.currentTest?.isFailed()) { - callbacks.printMessages(); - } - }) + const callbacks = new TestCompilerCallbacks(this); it('should have a valid KeyboardInfoCompilerMessages object', function() { return verifyCompilerMessagesObject(KeyboardInfoCompilerMessages, CompilerErrorNamespace.KeyboardInfoCompiler); diff --git a/developer/src/kmc-keyboard-info/test/keyboard-info-compiler.tests.ts b/developer/src/kmc-keyboard-info/test/keyboard-info-compiler.tests.ts index 0bb17e539e..b9345e7508 100644 --- a/developer/src/kmc-keyboard-info/test/keyboard-info-compiler.tests.ts +++ b/developer/src/kmc-keyboard-info/test/keyboard-info-compiler.tests.ts @@ -10,18 +10,6 @@ import { KMX, KeymanFileTypes, KeymanTargets, KmpJsonFile } from '@keymanapp/com import { CompilerCallbacks } from '@keymanapp/developer-utils'; import { KeyboardInfoFile, KeyboardInfoFileLanguage, KeyboardInfoFilePlatform } from './keyboard-info-file.js'; -const callbacks = new TestCompilerCallbacks(); - -beforeEach(function() { - callbacks.clear(); -}); - -afterEach(function() { - if(this.currentTest?.isFailed()) { - callbacks.printMessages(); - } -}); - const KHMER_ANGKOR_KPJ = makePathToFixture('khmer_angkor', 'khmer_angkor.kpj'); const KHMER_ANGKOR_JS = makePathToFixture('khmer_angkor', 'build', 'khmer_angkor.js'); const KHMER_ANGKOR_KPS = makePathToFixture('khmer_angkor', 'source', 'khmer_angkor.kps'); @@ -87,6 +75,9 @@ const JAVA_DISPLAY_FONT_INFO = { family: "Java", source: [ JAVA_DISPLAY_FONT ] } const JAVA_OSK_FONT_INFO = { family: "Java Kbd", source: [ JAVA_OSK_FONT ] }; describe('keyboard-info-compiler', function () { + + const callbacks = new TestCompilerCallbacks(this); + it('compile a .keyboard_info file correctly', async function() { const kpjFilename = KHMER_ANGKOR_KPJ; const buildKeyboardInfoFilename = makePathToFixture('khmer_angkor', 'build', 'khmer_angkor.keyboard_info'); @@ -844,6 +835,9 @@ describe('keyboard-info-compiler', function () { }); describe('fillLanguageMetadata', function() { + + const callbacks = new TestCompilerCallbacks(this); + const tests: { bcp47: string, lang: KeyboardInfoFileLanguage, commonScript: string }[] = [ // 'und' language subtag diff --git a/developer/src/kmc-kmn/package.json b/developer/src/kmc-kmn/package.json index f9c82fb4e9..88a172dfbb 100644 --- a/developer/src/kmc-kmn/package.json +++ b/developer/src/kmc-kmn/package.json @@ -32,8 +32,6 @@ }, "devDependencies": { "@keymanapp/developer-test-helpers": "*", - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "@types/semver": "^7.3.12", "@types/sinon": "^10.0.13", "@types/sinon-chai": "^3.2.9", diff --git a/developer/src/kmc-kmn/test/compiler.tests.ts b/developer/src/kmc-kmn/test/compiler.tests.ts index cb190f519d..7b67e3dd58 100644 --- a/developer/src/kmc-kmn/test/compiler.tests.ts +++ b/developer/src/kmc-kmn/test/compiler.tests.ts @@ -11,6 +11,8 @@ const keyboardsDir = __dirname + '/../../../../../common/test/keyboards/'; const baselineDir = keyboardsDir + 'baseline/'; describe('Compiler class', function() { + const callbacks = new TestCompilerCallbacks(this); + it('should throw on failure', async function() { const compiler = new KmnCompiler(); const callbacks : any = null; // ERROR @@ -25,14 +27,12 @@ describe('Compiler class', function() { it('should start', async function() { const compiler = new KmnCompiler(); - const callbacks = new TestCompilerCallbacks(); assert(await compiler.init(callbacks, null)); assert(compiler.verifyInitialized()); }); it('should compile a basic keyboard', async function() { const compiler = new KmnCompiler(); - const callbacks = new TestCompilerCallbacks(); assert(await compiler.init(callbacks, {saveDebug: true, shouldAddCompilerVersion: false})); assert(compiler.verifyInitialized()); @@ -60,7 +60,6 @@ describe('Compiler class', function() { it('should build all baseline fixtures', async function() { this.timeout(10000); // there are quite a few fixtures, sometimes CI agents are slow const compiler = new KmnCompiler(); - const callbacks = new TestCompilerCallbacks(); assert(await compiler.init(callbacks, {saveDebug: true, shouldAddCompilerVersion: false})); assert(compiler.verifyInitialized()); @@ -90,7 +89,6 @@ describe('Compiler class', function() { it('should compile a keyboard with visual keyboard', async function() { const compiler = new KmnCompiler(); - const callbacks = new TestCompilerCallbacks(); assert.isTrue(await compiler.init(callbacks, { saveDebug: true, shouldAddCompilerVersion: false, diff --git a/developer/src/kmc-kmn/test/features.tests.ts b/developer/src/kmc-kmn/test/features.tests.ts index 1f82a03ed5..6d8f0bde19 100644 --- a/developer/src/kmc-kmn/test/features.tests.ts +++ b/developer/src/kmc-kmn/test/features.tests.ts @@ -7,19 +7,14 @@ import { KMX, KmxFileReader } from '@keymanapp/common-types'; describe('Keyboard compiler features', function() { let compiler: KmnCompiler = null; - let callbacks: TestCompilerCallbacks = null; + const callbacks = new TestCompilerCallbacks(this); this.beforeAll(async function() { compiler = new KmnCompiler(); - callbacks = new TestCompilerCallbacks(); assert(await compiler.init(callbacks, {saveDebug: true})); assert(compiler.verifyInitialized()); }); - beforeEach(function() { - callbacks.clear(); - }); - // Test each Keyman file version target const versions = [ diff --git a/developer/src/kmc-kmn/test/kmn-compiler-messages.tests.ts b/developer/src/kmc-kmn/test/kmn-compiler-messages.tests.ts index 055535513d..f241c02606 100644 --- a/developer/src/kmc-kmn/test/kmn-compiler-messages.tests.ts +++ b/developer/src/kmc-kmn/test/kmn-compiler-messages.tests.ts @@ -7,7 +7,7 @@ import { KmnCompilerMessageRanges, KmnCompilerMessages } from '../src/compiler/k import { makePathToFixture } from './helpers/index.js'; describe('KmnCompilerMessages', function () { - const callbacks = new TestCompilerCallbacks(); + const callbacks = new TestCompilerCallbacks(this); it('should have a valid KmnCompilerMessages object', function() { return verifyCompilerMessagesObject(KmnCompilerMessages, CompilerErrorNamespace.KmnCompiler); diff --git a/developer/src/kmc-kmn/test/kmw/kmw-compiler.tests.ts b/developer/src/kmc-kmn/test/kmw/kmw-compiler.tests.ts index a1008416aa..9fb4563d29 100644 --- a/developer/src/kmc-kmn/test/kmw/kmw-compiler.tests.ts +++ b/developer/src/kmc-kmn/test/kmw/kmw-compiler.tests.ts @@ -25,7 +25,7 @@ const generateTestFilenames = (id: string) => ({ }); describe('KeymanWeb Compiler', function() { - const callbacks = new TestCompilerCallbacks(); + const callbacks = new TestCompilerCallbacks(this); const kmnCompiler: KmnCompiler = new KmnCompiler(); this.beforeAll(async function() { @@ -35,13 +35,6 @@ describe('KeymanWeb Compiler', function() { })); }); - this.afterEach(function() { - if(this.currentTest?.isFailed() || debug) { - callbacks.printMessages(); - } - callbacks.clear(); - }); - it('should compile a complex keyboard', async function() { await run_test_keyboard(kmnCompiler, 'khmer_angkor'); }); diff --git a/developer/src/kmc-kmn/test/kmw/kmw-messages.tests.ts b/developer/src/kmc-kmn/test/kmw/kmw-messages.tests.ts index a69db77020..175afdfe7a 100644 --- a/developer/src/kmc-kmn/test/kmw/kmw-messages.tests.ts +++ b/developer/src/kmc-kmn/test/kmw/kmw-messages.tests.ts @@ -7,7 +7,7 @@ import { KmnCompiler } from '../../src/main.js'; import { CompilerErrorNamespace } from '@keymanapp/developer-utils'; describe('KmwCompilerMessages', function () { - const callbacks = new TestCompilerCallbacks(); + const callbacks = new TestCompilerCallbacks(this); it('should have a valid KmwCompilerMessages object', function() { return verifyCompilerMessagesObject(KmwCompilerMessages, CompilerErrorNamespace.KmwCompiler); diff --git a/developer/src/kmc-kmn/test/wasm-uset.tests.ts b/developer/src/kmc-kmn/test/wasm-uset.tests.ts index ad67b35246..11a3e9a487 100644 --- a/developer/src/kmc-kmn/test/wasm-uset.tests.ts +++ b/developer/src/kmc-kmn/test/wasm-uset.tests.ts @@ -6,6 +6,8 @@ import { KmnCompilerMessages } from '../src/compiler/kmn-compiler-messages.js'; import { compilerErrorFormatCode } from '@keymanapp/developer-utils'; describe('Compiler UnicodeSet function', function() { + const callbacks = new TestCompilerCallbacks(this); + it('should fixup "short" \\u{} escapes', function () { assert.equal(KmnCompiler.fixNewPattern(`\\u{A}`), `\\u000A`); // " assert.equal(KmnCompiler.fixNewPattern(`\\u{22}`), `\\u0022`); // " @@ -24,14 +26,12 @@ describe('Compiler UnicodeSet function', function() { it('should start', async function() { const compiler = new KmnCompiler(); - const callbacks = new TestCompilerCallbacks(); assert(await compiler.init(callbacks, null)); assert(compiler.verifyInitialized()); }); it('should compile a basic uset', async function() { const compiler = new KmnCompiler(); - const callbacks = new TestCompilerCallbacks(); assert(await compiler.init(callbacks, null)); assert(compiler.verifyInitialized()); @@ -49,7 +49,6 @@ describe('Compiler UnicodeSet function', function() { }); it('should compile a more complex uset', async function() { const compiler = new KmnCompiler(); - const callbacks = new TestCompilerCallbacks(); assert(await compiler.init(callbacks, null)); assert(compiler.verifyInitialized()); @@ -69,7 +68,6 @@ describe('Compiler UnicodeSet function', function() { }); it('should compile an even more complex uset', async function() { const compiler = new KmnCompiler(); - const callbacks = new TestCompilerCallbacks(); assert(await compiler.init(callbacks, null)); assert(compiler.verifyInitialized()); @@ -96,7 +94,6 @@ describe('Compiler UnicodeSet function', function() { }); it('should fail in various ways', async function() { const compiler = new KmnCompiler(); - const callbacks = new TestCompilerCallbacks(); assert(await compiler.init(callbacks, null)); assert(compiler.verifyInitialized()); // map from string to failing error diff --git a/developer/src/kmc-ldml/package.json b/developer/src/kmc-ldml/package.json index 9e2a1c6831..1a586eec78 100644 --- a/developer/src/kmc-ldml/package.json +++ b/developer/src/kmc-ldml/package.json @@ -35,8 +35,6 @@ "@keymanapp/developer-test-helpers": "*", "@keymanapp/resources-gosh": "*", "@types/common-tags": "^1.8.4", - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "@types/semver": "^7.3.12", "abnf": "^4.3.1", "c8": "^7.12.0", diff --git a/developer/src/kmc-model-info/package.json b/developer/src/kmc-model-info/package.json index c747a922c4..7d1e7f2fef 100644 --- a/developer/src/kmc-model-info/package.json +++ b/developer/src/kmc-model-info/package.json @@ -34,8 +34,6 @@ "@keymanapp/developer-utils": "*" }, "devDependencies": { - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "c8": "^7.12.0", "chalk": "^2.4.2", "typescript": "^5.4.5" diff --git a/developer/src/kmc-model-info/test/model-info-compiler.tests.ts b/developer/src/kmc-model-info/test/model-info-compiler.tests.ts index 4b0a85624e..5f87ad0f21 100644 --- a/developer/src/kmc-model-info/test/model-info-compiler.tests.ts +++ b/developer/src/kmc-model-info/test/model-info-compiler.tests.ts @@ -6,13 +6,9 @@ import { makePathToFixture } from './helpers/index.js'; import { ModelInfoCompiler } from '../src/model-info-compiler.js'; import { KmpCompiler } from '@keymanapp/kmc-package'; -const callbacks = new TestCompilerCallbacks(); - -beforeEach(function() { - callbacks.clear(); -}); - describe('model-info-compiler', function () { + const callbacks = new TestCompilerCallbacks(this); + it('compile a .model_info file correctly', async function() { const kpjFilename = makePathToFixture('sil.cmo.bw', 'sil.cmo.bw.model.kpj'); const kpsFilename = makePathToFixture('sil.cmo.bw', 'source', 'sil.cmo.bw.model.kps'); diff --git a/developer/src/kmc-model/package.json b/developer/src/kmc-model/package.json index 481822e686..52ef40c425 100644 --- a/developer/src/kmc-model/package.json +++ b/developer/src/kmc-model/package.json @@ -37,8 +37,6 @@ "devDependencies": { "@keymanapp/developer-test-helpers": "*", "@keymanapp/models-templates": "*", - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "c8": "^7.12.0", "chalk": "^2.4.2", "esbuild": "^0.25.0" diff --git a/developer/src/kmc-model/test/compile-model-with-pseudoclosure.tests.ts b/developer/src/kmc-model/test/compile-model-with-pseudoclosure.tests.ts index c4d3334b6a..6a8b55af7e 100644 --- a/developer/src/kmc-model/test/compile-model-with-pseudoclosure.tests.ts +++ b/developer/src/kmc-model/test/compile-model-with-pseudoclosure.tests.ts @@ -7,7 +7,7 @@ import { TestCompilerCallbacks } from '@keymanapp/developer-test-helpers'; import { LexicalModelTypes } from '@keymanapp/common-types'; describe('LexicalModelCompiler - pseudoclosure compilation + use', function () { - const callbacks = new TestCompilerCallbacks(); + const callbacks = new TestCompilerCallbacks(this); const MODEL_ID = 'example.qaa.trivial'; const PATH = makePathToFixture(MODEL_ID); diff --git a/developer/src/kmc-model/test/compile-model.tests.ts b/developer/src/kmc-model/test/compile-model.tests.ts index e5c9e86c15..5c6a8ab104 100644 --- a/developer/src/kmc-model/test/compile-model.tests.ts +++ b/developer/src/kmc-model/test/compile-model.tests.ts @@ -7,7 +7,7 @@ import { TestCompilerCallbacks } from '@keymanapp/developer-test-helpers'; import { KeymanFileTypes } from '@keymanapp/common-types'; describe('LexicalModelCompiler', function () { - const callbacks = new TestCompilerCallbacks(); + const callbacks = new TestCompilerCallbacks(this); this.timeout(5000); diff --git a/developer/src/kmc-model/test/compile-trie.tests.ts b/developer/src/kmc-model/test/compile-trie.tests.ts index 81de56987e..24f05bb7ec 100644 --- a/developer/src/kmc-model/test/compile-trie.tests.ts +++ b/developer/src/kmc-model/test/compile-trie.tests.ts @@ -11,10 +11,7 @@ import { TrieModel } from '@keymanapp/models-templates'; import { LexicalModelTypes } from '@keymanapp/common-types'; describe('LexicalModelCompiler', function () { - const callbacks = new TestCompilerCallbacks(); - this.beforeEach(function() { - callbacks.clear(); - }); + const callbacks = new TestCompilerCallbacks(this); describe('#generateLexicalModelCode', function () { it('should compile a trivial word list', async function () { diff --git a/developer/src/kmc-model/test/messages.tests.ts b/developer/src/kmc-model/test/messages.tests.ts index f9d3eb07b8..8d3bb10c08 100644 --- a/developer/src/kmc-model/test/messages.tests.ts +++ b/developer/src/kmc-model/test/messages.tests.ts @@ -8,17 +8,7 @@ import { makePathToFixture } from './helpers/index.js'; describe('ModelCompilerMessages', function () { - const callbacks = new TestCompilerCallbacks(); - - this.beforeEach(function() { - callbacks.clear(); - }); - - this.afterEach(function() { - if(this.currentTest?.isFailed()) { - callbacks.printMessages(); - } - }); + const callbacks = new TestCompilerCallbacks(this); it('should have a valid ModelCompilerMessages object', function() { return verifyCompilerMessagesObject(ModelCompilerMessages, CompilerErrorNamespace.ModelCompiler); diff --git a/developer/src/kmc-model/test/parse-wordlist.tests.ts b/developer/src/kmc-model/test/parse-wordlist.tests.ts index ada01fbc2b..ba4f6cb92b 100644 --- a/developer/src/kmc-model/test/parse-wordlist.tests.ts +++ b/developer/src/kmc-model/test/parse-wordlist.tests.ts @@ -22,11 +22,10 @@ const SENCOTEN_WORDLIST = { describe('parsing a word list', function () { - const testCallbacks = new TestCompilerCallbacks(); + const callbacks = new TestCompilerCallbacks(this); beforeEach(function () { - testCallbacks.clear(); - setCompilerCallbacks(testCallbacks); + setCompilerCallbacks(callbacks); }); afterEach(function () { @@ -43,12 +42,12 @@ describe('parsing a word list', function () { const withoutBOM: WordList = {}; parseWordListFromContents(withoutBOM, file); assert.deepEqual(withoutBOM, expected, "expected regular file to parse properly"); - assert.isEmpty(testCallbacks.messages); + assert.isEmpty(callbacks.messages); const withBOM: WordList = {}; parseWordListFromContents(withBOM, `${BOM}${file}`) assert.deepEqual(withBOM, expected, "expected BOM to be ignored"); - assert.isEmpty(testCallbacks.messages); + assert.isEmpty(callbacks.messages); }); it('should read word lists in UTF-8', function () { @@ -58,7 +57,7 @@ describe('parsing a word list', function () { parseWordListFromFilename(wordlist, filename); assert.deepEqual(wordlist, SENCOTEN_WORDLIST); - assert.isEmpty(testCallbacks.messages); + assert.isEmpty(callbacks.messages); }); it('should read word lists in UTF-16 little-endian (with BOM)', function () { @@ -69,7 +68,7 @@ describe('parsing a word list', function () { parseWordListFromFilename(wordlist, filename); assert.deepEqual(wordlist, SENCOTEN_WORDLIST); - assert.isEmpty(testCallbacks.messages); + assert.isEmpty(callbacks.messages); }); it('should NOT read word lists in UTF-16 big-endian (with BOM)', function () { @@ -106,22 +105,22 @@ describe('parsing a word list', function () { assert.deepEqual(repeatedWords, expected); - assert.lengthOf(testCallbacks.messages, 4); + assert.lengthOf(callbacks.messages, 4); // hello has been seen multiple times: - assert.isTrue(testCallbacks.hasMessage(ModelCompilerMessages.HINT_DuplicateWordInSameFile)); + assert.isTrue(callbacks.hasMessage(ModelCompilerMessages.HINT_DuplicateWordInSameFile)); // helló and hello + U+0301 have both been seen: - assert.isTrue(testCallbacks.hasMessage(ModelCompilerMessages.HINT_MixedNormalizationForms)); + assert.isTrue(callbacks.hasMessage(ModelCompilerMessages.HINT_MixedNormalizationForms)); // Let's parse another file: - testCallbacks.clear(); + callbacks.clear(); // Now, parse a DIFFERENT file, but with an NFD entry. parseWordListFromContents(repeatedWords, "hello\u0301\t5\n"); - assert.lengthOf(testCallbacks.messages, 1); + assert.lengthOf(callbacks.messages, 1); // hello + U+0301 (NFD) has been seen, but... - assert.isTrue(testCallbacks.hasMessage(ModelCompilerMessages.HINT_MixedNormalizationForms)); + assert.isTrue(callbacks.hasMessage(ModelCompilerMessages.HINT_MixedNormalizationForms)); // BUT! We have not seen a duplicate **within the same file** - assert.isFalse(testCallbacks.hasMessage(ModelCompilerMessages.HINT_DuplicateWordInSameFile)); + assert.isFalse(callbacks.hasMessage(ModelCompilerMessages.HINT_DuplicateWordInSameFile)); assert.deepEqual(repeatedWords, { hello: expected['hello'], diff --git a/developer/src/kmc-model/test/punctuation.tests.ts b/developer/src/kmc-model/test/punctuation.tests.ts index c3679f08d9..e0f1d661b4 100644 --- a/developer/src/kmc-model/test/punctuation.tests.ts +++ b/developer/src/kmc-model/test/punctuation.tests.ts @@ -6,12 +6,13 @@ import { makePathToFixture, compileModelSourceCode } from './helpers/index.js'; import { TestCompilerCallbacks } from '@keymanapp/developer-test-helpers'; describe('LexicalModelCompiler', function () { + const callbacks = new TestCompilerCallbacks(this); + describe('specifying punctuation', function () { const MODEL_ID = 'example.qaa.trivial'; const PATH = makePathToFixture(MODEL_ID); it('should compile punctuation into the generated code', async function () { - const callbacks = new TestCompilerCallbacks(); const compiler = new LexicalModelCompiler(); assert.isTrue(await compiler.init(callbacks, null)); diff --git a/developer/src/kmc-package/package.json b/developer/src/kmc-package/package.json index edfba42073..e441b5d57b 100644 --- a/developer/src/kmc-package/package.json +++ b/developer/src/kmc-package/package.json @@ -36,8 +36,6 @@ }, "devDependencies": { "@keymanapp/developer-test-helpers": "*", - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "c8": "^7.12.0", "chalk": "^2.4.2", "typescript": "^5.4.5" diff --git a/developer/src/kmc-package/test/messages.tests.ts b/developer/src/kmc-package/test/messages.tests.ts index 21f1e0e4a2..934226e024 100644 --- a/developer/src/kmc-package/test/messages.tests.ts +++ b/developer/src/kmc-package/test/messages.tests.ts @@ -10,15 +10,10 @@ import { makePathToFixture } from './helpers/index.js'; import { KmpCompiler } from '../src/compiler/kmp-compiler.js'; import { CompilerErrorNamespace, CompilerOptions } from '@keymanapp/developer-utils'; -const callbacks = new TestCompilerCallbacks(); describe('PackageCompilerMessages', function () { - this.afterEach(function() { - if(this.currentTest.isFailed()) { - callbacks.printMessages(); - } - }); + const callbacks = new TestCompilerCallbacks(this); it('should have a valid PackageCompilerMessages object', function() { return verifyCompilerMessagesObject(PackageCompilerMessages, CompilerErrorNamespace.PackageCompiler); diff --git a/developer/src/kmc-package/test/package-compiler.tests.ts b/developer/src/kmc-package/test/package-compiler.tests.ts index 9dcad78054..77fbf75cdb 100644 --- a/developer/src/kmc-package/test/package-compiler.tests.ts +++ b/developer/src/kmc-package/test/package-compiler.tests.ts @@ -21,22 +21,14 @@ describe('KmpCompiler', function () { 'example.qaa.sencoten', 'withfolders.qaa.sencoten', ]; - const callbacks = new TestCompilerCallbacks(); + const callbacks = new TestCompilerCallbacks(this); let kmpCompiler: KmpCompiler = null; this.beforeAll(async function() { - callbacks.clear(); kmpCompiler = new KmpCompiler(); assert.isTrue(await kmpCompiler.init(callbacks, null)); }); - this.afterEach(function() { - if(this.currentTest?.isFailed()) { - callbacks.printMessages(); - } - callbacks.clear(); - }); - for (const modelID of MODELS) { const kpsPath = modelID.includes('withfolders') ? makePathToFixture(modelID, 'source', `${modelID}.model.kps`) : makePathToFixture(modelID, `${modelID}.model.kps`); diff --git a/developer/src/kmc-package/test/versioning.tests.ts b/developer/src/kmc-package/test/versioning.tests.ts index adcba30019..91ec523e65 100644 --- a/developer/src/kmc-package/test/versioning.tests.ts +++ b/developer/src/kmc-package/test/versioning.tests.ts @@ -11,6 +11,7 @@ import { makePathToFixture } from './helpers/index.js'; // test results documented below. describe('package versioning', function () { + const callbacks = new TestCompilerCallbacks(this); const cases: [string,string][] = [ ['test-single-version-1-package', 'test1.kps'], @@ -33,7 +34,6 @@ describe('package versioning', function () { for(const [ caseTitle, filename ] of cases) { it(caseTitle, async function () { - const callbacks = new TestCompilerCallbacks(); const kmpCompiler = new KmpCompiler(); assert.isTrue(await kmpCompiler.init(callbacks, null)); diff --git a/developer/src/kmc-package/test/windows-package-installer-compiler.tests.ts b/developer/src/kmc-package/test/windows-package-installer-compiler.tests.ts index f61b65d8aa..c4843942a7 100644 --- a/developer/src/kmc-package/test/windows-package-installer-compiler.tests.ts +++ b/developer/src/kmc-package/test/windows-package-installer-compiler.tests.ts @@ -9,6 +9,8 @@ import { makePathToFixture } from './helpers/index.js'; import { WindowsPackageInstallerCompiler, WindowsPackageInstallerSources } from '../src/compiler/windows-package-installer-compiler.js'; describe('WindowsPackageInstallerCompiler', function () { + const callbacks = new TestCompilerCallbacks(this); + it(`should build an SFX archive`, async function () { this.timeout(10000); // this test can take a little while to run @@ -22,7 +24,6 @@ describe('WindowsPackageInstallerCompiler', function () { appName: 'Testing', }; - const callbacks = new TestCompilerCallbacks(); const compiler = new WindowsPackageInstallerCompiler(); assert.isTrue(await compiler.init(callbacks, {sources})); @@ -44,7 +45,7 @@ describe('WindowsPackageInstallerCompiler', function () { const zipBuffer = sfxBuffer.slice(setupExeSize); // Verify setup.exe sfx loader - const setupExeFixture = fs.readFileSync(sources.setupExeFilename); + const setupExeFixture = fs.readFileSync(sources.setupExeFilename) as Uint8Array; assert.deepEqual(setupExe, setupExeFixture); // Load the zip from the buffer @@ -68,7 +69,7 @@ khmer_angkor.kmp assert.equal(setupInf.trim(), setupInfFixture.trim()); const verifyFile = async (filename: string) => { - const fixture = fs.readFileSync(filename); + const fixture = fs.readFileSync(filename) as Uint8Array; const file = await zipFile.file(path.basename(filename)).async('uint8array'); assert.deepEqual(file, fixture, `File in zip '${filename}' did not match fixture`); }; diff --git a/developer/src/kmc/package.json b/developer/src/kmc/package.json index 39d839bc84..4f15f5e98c 100644 --- a/developer/src/kmc/package.json +++ b/developer/src/kmc/package.json @@ -53,8 +53,6 @@ ], "devDependencies": { "@sentry/cli": "^2.31.0", - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "c8": "^7.12.0", "esbuild": "^0.25.0", "typescript": "^5.4.5" diff --git a/developer/src/server/package.json b/developer/src/server/package.json index 37192ca6f3..ee58b4d649 100644 --- a/developer/src/server/package.json +++ b/developer/src/server/package.json @@ -29,9 +29,7 @@ "@keymanapp/keyman-version": "*", "@keymanapp/resources-gosh": "*", "@types/express": "^4.17.13", - "@types/mocha": "^9.1.0", "@types/multer": "^1.4.12", - "@types/node": "^20.4.1", "@types/ws": "^8.2.2", "copyfiles": "^2.4.1", "node-gyp": "^10.2.0", diff --git a/package-lock.json b/package-lock.json index 61a304996b..ca632dbea4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,6 +47,7 @@ "@microsoft/api-documenter": "^7.28.0", "@microsoft/api-extractor": "^7.47.3", "@types/chai": "^4.3.14", + "@types/mocha": "^10.0.10", "@types/node": "^20.4.1", "@typescript-eslint/eslint-plugin": "^7.13.1", "@web/dev-server-esbuild": "^1.0.2", @@ -149,8 +150,6 @@ "restructure": "3.0.1" }, "devDependencies": { - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "ajv": "^8.12.0", "ajv-cli": "^5.0.0", "ajv-formats": "^2.1.1", @@ -160,11 +159,6 @@ "typescript": "^5.4.5" } }, - "common/web/types/node_modules/@types/mocha": { - "version": "5.2.7", - "dev": true, - "license": "MIT" - }, "common/web/types/node_modules/ansi-styles": { "version": "3.2.1", "dev": true, @@ -285,8 +279,6 @@ }, "devDependencies": { "@sentry/cli": "^2.31.0", - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "c8": "^7.12.0", "esbuild": "^0.25.0", "typescript": "^5.4.5" @@ -302,19 +294,11 @@ }, "devDependencies": { "@keymanapp/resources-gosh": "*", - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "c8": "^7.12.0", "chalk": "^2.4.2", "typescript": "^5.4.5" } }, - "developer/src/kmc-analyze/node_modules/@types/mocha": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", - "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", - "dev": true - }, "developer/src/kmc-analyze/node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -581,19 +565,11 @@ "@keymanapp/langtags": "*" }, "devDependencies": { - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "c8": "^7.12.0", "chalk": "^2.4.2", "typescript": "^5.4.5" } }, - "developer/src/kmc-keyboard-info/node_modules/@types/mocha": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", - "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", - "dev": true - }, "developer/src/kmc-keyboard-info/node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -666,8 +642,6 @@ }, "devDependencies": { "@keymanapp/developer-test-helpers": "*", - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "@types/semver": "^7.3.12", "@types/sinon": "^10.0.13", "@types/sinon-chai": "^3.2.9", @@ -677,12 +651,6 @@ "typescript": "^5.4.5" } }, - "developer/src/kmc-kmn/node_modules/@types/mocha": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", - "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", - "dev": true - }, "developer/src/kmc-kmn/node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -759,8 +727,6 @@ "@keymanapp/developer-test-helpers": "*", "@keymanapp/resources-gosh": "*", "@types/common-tags": "^1.8.4", - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "@types/semver": "^7.3.12", "abnf": "^4.3.1", "c8": "^7.12.0", @@ -770,12 +736,6 @@ "typescript": "^5.4.5" } }, - "developer/src/kmc-ldml/node_modules/@types/mocha": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", - "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", - "dev": true - }, "developer/src/kmc-ldml/node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -849,8 +809,6 @@ "devDependencies": { "@keymanapp/developer-test-helpers": "*", "@keymanapp/models-templates": "*", - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "c8": "^7.12.0", "chalk": "^2.4.2", "esbuild": "^0.25.0" @@ -864,18 +822,11 @@ "@keymanapp/developer-utils": "*" }, "devDependencies": { - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "c8": "^7.12.0", "chalk": "^2.4.2", "typescript": "^5.4.5" } }, - "developer/src/kmc-model-info/node_modules/@types/mocha": { - "version": "5.2.7", - "dev": true, - "license": "MIT" - }, "developer/src/kmc-model-info/node_modules/ansi-styles": { "version": "3.2.1", "dev": true, @@ -932,11 +883,6 @@ "node": ">=4" } }, - "developer/src/kmc-model/node_modules/@types/mocha": { - "version": "5.2.7", - "dev": true, - "license": "MIT" - }, "developer/src/kmc-model/node_modules/ansi-styles": { "version": "3.2.1", "dev": true, @@ -1004,18 +950,11 @@ }, "devDependencies": { "@keymanapp/developer-test-helpers": "*", - "@types/mocha": "^5.2.7", - "@types/node": "^20.4.1", "c8": "^7.12.0", "chalk": "^2.4.2", "typescript": "^5.4.5" } }, - "developer/src/kmc-package/node_modules/@types/mocha": { - "version": "5.2.7", - "dev": true, - "license": "MIT" - }, "developer/src/kmc-package/node_modules/ansi-styles": { "version": "3.2.1", "dev": true, @@ -1072,11 +1011,6 @@ "node": ">=4" } }, - "developer/src/kmc/node_modules/@types/mocha": { - "version": "5.2.7", - "dev": true, - "license": "MIT" - }, "developer/src/kmc/node_modules/ansi-styles": { "version": "3.2.1", "license": "MIT", @@ -1162,9 +1096,7 @@ "@keymanapp/keyman-version": "*", "@keymanapp/resources-gosh": "*", "@types/express": "^4.17.13", - "@types/mocha": "^9.1.0", "@types/multer": "^1.4.12", - "@types/node": "^20.4.1", "@types/ws": "^8.2.2", "copyfiles": "^2.4.1", "node-gyp": "^10.2.0", @@ -1175,11 +1107,6 @@ "node-hide-console-window": "^2.2.0" } }, - "developer/src/server/node_modules/@types/mocha": { - "version": "9.1.1", - "dev": true, - "license": "MIT" - }, "developer/src/server/node_modules/@types/multer": { "version": "1.4.12", "resolved": "https://registry.npmjs.org/@types/multer/-/multer-1.4.12.tgz", @@ -3480,7 +3407,9 @@ "license": "MIT" }, "node_modules/@types/mocha": { - "version": "7.0.2", + "version": "10.0.10", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", + "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", "dev": true, "license": "MIT" }, @@ -4679,6 +4608,15 @@ "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", "license": "MIT" }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/argparse": { "version": "2.0.1", "dev": true, @@ -5842,6 +5780,15 @@ "version": "1.0.3", "license": "MIT" }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -9846,6 +9793,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true, + "license": "ISC", + "optional": true, + "peer": true + }, "node_modules/make-fetch-happen": { "version": "13.0.1", "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-13.0.1.tgz", @@ -12939,6 +12895,47 @@ "typescript": ">=4.2.0" } }, + "node_modules/ts-node": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", + "integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "typescript": ">=2.7" + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz", + "integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "peer": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/tsc-watch": { "version": "4.6.2", "dev": true, @@ -13779,6 +13776,18 @@ "node": ">= 4.0.0" } }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "dev": true, @@ -14097,7 +14106,6 @@ "devDependencies": { "@keymanapp/common-types": "*", "@keymanapp/web-utils": "*", - "@types/mocha": "^7.0.2", "c8": "^7.12.0", "typescript": "^5.4.5" } @@ -14115,7 +14123,6 @@ "devDependencies": { "@keymanapp/common-types": "*", "@keymanapp/resources-gosh": "*", - "@types/mocha": "^7.0.2", "c8": "^7.12.0", "typescript": "^5.4.5" } diff --git a/package.json b/package.json index 7f033959d8..8bad452796 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "@microsoft/api-documenter": "^7.28.0", "@microsoft/api-extractor": "^7.47.3", "@types/chai": "^4.3.14", + "@types/mocha": "^10.0.10", "@types/node": "^20.4.1", "@typescript-eslint/eslint-plugin": "^7.13.1", "@web/dev-server-esbuild": "^1.0.2", diff --git a/web/src/engine/predictive-text/templates/package.json b/web/src/engine/predictive-text/templates/package.json index cbe3fb8747..fc1deedbfb 100644 --- a/web/src/engine/predictive-text/templates/package.json +++ b/web/src/engine/predictive-text/templates/package.json @@ -53,7 +53,6 @@ "devDependencies": { "@keymanapp/common-types": "*", "@keymanapp/web-utils": "*", - "@types/mocha": "^7.0.2", "c8": "^7.12.0", "typescript": "^5.4.5" }, diff --git a/web/src/engine/predictive-text/wordbreakers/package.json b/web/src/engine/predictive-text/wordbreakers/package.json index 0f73f19f69..5ebe40654b 100644 --- a/web/src/engine/predictive-text/wordbreakers/package.json +++ b/web/src/engine/predictive-text/wordbreakers/package.json @@ -56,7 +56,6 @@ "devDependencies": { "@keymanapp/common-types": "*", "@keymanapp/resources-gosh": "*", - "@types/mocha": "^7.0.2", "c8": "^7.12.0", "typescript": "^5.4.5" }, diff --git a/web/src/test/auto/headless/engine/main/headless/languageProcessor.tests.js b/web/src/test/auto/headless/engine/main/headless/languageProcessor.tests.js index 6d866ef8ed..e5b8856016 100644 --- a/web/src/test/auto/headless/engine/main/headless/languageProcessor.tests.js +++ b/web/src/test/auto/headless/engine/main/headless/languageProcessor.tests.js @@ -22,11 +22,10 @@ global.keyman = {}; // So that keyboard-based checks against the global `keyman` // Test the KeyboardProcessor interface. describe('LanguageProcessor', function() { let languageProcessor; - const callbacks = new TestCompilerCallbacks(); + const callbacks = new TestCompilerCallbacks(this); beforeEach(function() { languageProcessor = new LanguageProcessor(LMWorker, new TranscriptionCache()); - callbacks.clear(); }); afterEach(function() {