Skip to content

Commit

Permalink
chore(web): fixes pred-text karma config
Browse files Browse the repository at this point in the history
The upgrade to chai means that karma's 'framework' feature is no longer compatible, meaning a _little_ extra legwork is required to use it for karma browser tests.  It's just a little bit, though.

Will need to replicate this for the other packages that use karma to test, as the pattern kinda proliferated.
  • Loading branch information
jahorton committed Apr 25, 2024
1 parent 8d03cbd commit ffbea17
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 14 deletions.
6 changes: 5 additions & 1 deletion common/predictive-text/unit_tests/in_browser/base.conf.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ module.exports = {

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai', 'fixture'],
frameworks: ['mocha', 'fixture'],

// list of files / patterns to load in the browser
files: [
{ pattern: 'node_modules/chai/chai.js', served: true, watched: false, included: false, type: 'module'},
// { pattern: 'node_modules/**/*.js', served: true, watched: false, included: false },
// { pattern: 'node_modules/**/*.mjs', served: true, watched: false, included: false, type: "module" },
// { pattern: 'node_modules/**/*.cjs', served: true, watched: false, included: false },
Expand Down Expand Up @@ -82,6 +83,9 @@ module.exports = {
// enable / disable colors in the output (reporters and logs)
colors: true,

// TEMP ENTRY!
reporters: ['teamcity'],

// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var assert = chai.assert;
import { assert } from '../../../../../node_modules/chai/chai.js';

/*
* A canary test to ensure our timeout configurations are working correctly for our CI.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var assert = chai.assert;
import { assert } from '../../../../../node_modules/chai/chai.js';

import { LMLayer, Worker as WorkerBuilder } from "../../../build/lib/web/index.mjs";
import * as helpers from "../helpers.mjs";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var assert = chai.assert;
import { assert } from '../../../../../node_modules/chai/chai.js';

import { LMLayer, Worker } from "../../../build/lib/web/index.mjs";
import * as helpers from "../helpers.mjs";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var assert = chai.assert;
import { assert } from '../../../../../node_modules/chai/chai.js';

import { LMLayer, Worker } from "../../../build/lib/web/index.mjs";
import * as helpers from "../helpers.mjs";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var assert = chai.assert;
import { assert } from '../../../../../node_modules/chai/chai.js';

import { Worker as WorkerBuilder } from "../../../build/lib/web/index.mjs";
import { LMLayerWorkerCode } from "/base/common/web/lm-worker/build/lib/worker-main.wrapped.min.js";
Expand Down
8 changes: 0 additions & 8 deletions common/predictive-text/unit_tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ if builder_start_action test:libraries; then
"$KEYMAN_ROOT/common/models/templates/build.sh" test $TEST_OPTS
popd

pushd "$KEYMAN_ROOT/common/models/types"
echo
echo "### Running $(builder_term common/models/types) tests"
# Is not mocha-based; it's TSC-based instead, as we're just ensuring that the .d.ts
# file is a proper TS declaration file.
npm run test
popd

pushd "$KEYMAN_ROOT/common/web/lm-worker"
echo
echo "### Running ${BUILDER_TERM_START}common/web/lm-worker${BUILDER_TERM_END} tests"
Expand Down

0 comments on commit ffbea17

Please sign in to comment.