Starting the local dev server before running the e2e tests with
`web/build.sh start` didn't work on Windows. This change now directly
calls `node` to start the server which seems to work cross-platform.
Fixes: #15895
Build-bot: skip build:web
Test-bot: skip
chore(web): cleanup `web/src/app/browser/src/test-index.ts` exports
The exports of `test-index.ts` were intended to be used by tests only, but over time they contained also exports that were consumed elsewhere, e.g. in UI classes like `kmwuibutton.ts`. This change removes unused exports, moves test-only classes to a `unitTestEndPoints` container and marks test-only types with `@internal`.
Fixes: #15894
refactor(web): move common code to abstract `KeyboardProcessor` base class
This change moves code that was implemented in both `JSKeyboardProcessor` and `CoreKeyboardProcessor` to the `AbstractKeyboardProcessor`. This got renamed from `KeyboardProcessor` and is now a generic abstract class.
Also removed some of the band-aids in `CoreKeyboardInterface` and `JSKeyboardInterface` that I put in before: Typescript allows implementations to have a slightly different method signature and still matches the interface as long as the used types are derived from the ones specified in the interface.
Follows: #15870
The export of `test-index.ts` were intended to be used by tests only,
but over time they contained also exports that were consumed else where,
e.g. in UI classes like `kmwuibutton.ts`. This change removes unused
exports, moves test-only classes to a `unitTestEndPoints` container and
marks test-only types with `@internal`.
Build-bot: skip build:web
Test-bot: skip
feat(web): clarify return type of `KeymanEngine.getKeyboardDetails` 🧼🎼
`getKeyboardDetails` can return `null` if `stub` is falsy. This PR changes the return type accordingly to improve type safety.
Follows: #15889
This change moves code that was implemented in both `JSKeyboardProcessor`
and `CoreKeyboardProcessor` to the `AbstractKeyboardProcessor`. This got
renamed from `KeyboardProcessor` and is now a generic abstract class.
Also removed some of the band-aids in `CoreKeyboardInterface` and
`JSKeyboardInterface` that I put in before: Typescript allows
implementations to have a slightly different method signature and still
matches the interface as long as the used types are derived from the ones
specified in the interface.
Follows: #15870
Build-bot: skip build:web
Test-bot: skip
This change will ignore keyboards where `getKeyboardDetails` returns
`null` and will not push them to the `detailsForAllKeyboards` array.
Addresses a code review comment.
refactor(web): use `KeyboardDetails` type 🧼🎼
PR #15856 introduced the `KeyboardDetails` type but overlooked the use in one file.
Follow-up-of: #15856
Follows: #15887
feat(web): get list of store names from stores defined in core
This implements `CoreKeyboardInterface.loadSerializedOptions` by getting the list of all variable store names from Core and then trying to load these.
Also change `VariableStoreSerializer.loadStore` signature so that it can return `undefined`. This allows to return only those options from `loadSerializedOptions` that have a non-default value, i.e. were serialized before.
Follow-up-of: #15470
`getKeyboardDetails` can return `null` if `stub` is falsy. This PR changes
the return type accordingly to improve type safety.
Follows: #15889
Build-bot: skip build:web
Test-bot: skip
PR #15856 introduced the `KeyboardDetails` type but overlooked the use in
one file.
Follow-up-of: #15856
Follows: #15887
Build-bot: skip build:web
Test-bot: skip
Having a file header that mentions an old version can be confusing, so
this change updates the file headers for the UI files with the current
header.
Build-bot: skip
Test-bot: skip
This implements `CoreKeyboardInterface.loadSerializedOptions` by getting
the list of all variable store names from Core and then trying to load
these.
Also change `VariableStoreSerializer.loadStore` signature so that it can
return `undefined`. This allows to return only those options from
`loadSerializedOptions` that have a non-default value, i.e. were
serialized before.
Build-bot: skip build:web
Test-bot: skip
This change explicitly specifies the return types and access for the
functions in KeymanEngine. Also introduce `KeyboardDetails` instead of
`ReturnType<>`.
Test-bot: skip
VSCode shows red squiggles under things like `describe` or `it` in
.ts test files for web. This change adds the types to the `tsconfig.json`
file which fixes this problem.
Build-bot: skip build:web
Test-bot: skip
To reduce the number of possible failure cases within KeymanWeb,
require variableStoreSerializer to always be initialized. This impacts
only unit tests in practice. There remains a unit test special case in
the variable store code itself which needs to be removed in the future.
Create a mock VariableStoreTestSerializer class so that unit tests can
run without impacting state or requiring cookies. (We should leverage
this in future tests to verify that variable stores are saved
correctly.)
Establish keyman/test/headless-resources, so that we can include shared
resources such as VariableStoreTestSerializer without creating a
dependency on either DOM or Node.
Refactor the `getModifierState` and `getStateFromLayer` functions into a
cleaner `modifierStringToState` function, and move from web into common.
Marks existing functions as deprecated but does not update usage at this
time.
- inline consts so that we don't have to export them for unit testing
- create `getKeymanRoot` and `getWebTestResourcesPath` helper functions
to DRY out the code
- run `languageProcessortests.js` without coverage to prevent a failure
creating the coverage report.
Simplify usage of `TestCompilerCallbacks` by making it responsible for
the `beforeEach` and `afterEach` incantations itself. There are a couple
of more complex usages of `TestCompilerCallbacks` which have been
excluded from this change on purpose.
Renamed `testCallbacks` to `callbacks` in the one place where it was
different.
Hoist @types/node and @types/mocha because inconsistent versions of
@types/mocha were causing compiler errors with this change.
Also added a cast to `fs.readFileSync` to `Uint8Array` to eliminate
compiler warnings/errors in test files.
Fixes: #15654
Test-bot: skip
The command shortcuts that were used by Web
scripts to create bundles via `esbuild` were not
properly handling the $KEYMAN_ROOT path when it
contained a space. These changes will rectify
this behavior and permit builds for such cases.
Build-bot: skip build:web
Test-bot: skip