This is an automated email from the ASF dual-hosted git repository.

randall pushed a commit to branch esm-tests
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git

commit 15b16b8be0ca0b3fdacf3f43aa3360870b5d45f7
Author: Randall Leeds <[email protected]>
AuthorDate: Sun Oct 31 21:39:50 2021 -0700

    Replace chai with built-in strict assert
    
    The chai package does not support named exports in a form that Node.js
    can detect them statically. In order to prepare the tests to run as real
    ECMAScript modules, switch to using the built-in assert module.
---
 package.json                                       |  2 -
 packages/dom/test/css/describe.test.ts             |  2 +-
 packages/dom/test/css/match.test.ts                |  2 +-
 .../dom/test/highlight-text/highlight-text.test.ts |  2 +-
 packages/dom/test/range/cartesian.test.ts          |  6 +--
 packages/dom/test/text-position/describe.test.ts   |  2 +-
 packages/dom/test/text-position/match.test.ts      |  2 +-
 packages/dom/test/text-quote/describe.test.ts      |  2 +-
 packages/dom/test/text-quote/match.test.ts         |  2 +-
 packages/dom/test/utils.ts                         |  2 +-
 test/data-model.test.ts                            |  4 +-
 yarn.lock                                          | 49 ----------------------
 12 files changed, 13 insertions(+), 64 deletions(-)

diff --git a/package.json b/package.json
index b11f69f..d4870c9 100644
--- a/package.json
+++ b/package.json
@@ -39,7 +39,6 @@
     "@babel/preset-env": "^7.13.12",
     "@babel/preset-typescript": "^7.13.0",
     "@babel/register": "^7.13.14",
-    "@types/chai": "^4.2.11",
     "@types/mocha": "^9.0.0",
     "@types/node-fetch": "^2.5.7",
     "@types/resolve": "^1.17.0",
@@ -51,7 +50,6 @@
     "babel-plugin-istanbul": "^6.0.0",
     "babel-plugin-module-resolver": "^4.0.0",
     "babel-plugin-preserve-comment-header": "^1.0.1",
-    "chai": "^4.2.0",
     "concurrently": "^5.3.0",
     "cross-env": "^6.0.3",
     "eslint": "^7.5.0",
diff --git a/packages/dom/test/css/describe.test.ts 
b/packages/dom/test/css/describe.test.ts
index 882b984..a0309bd 100644
--- a/packages/dom/test/css/describe.test.ts
+++ b/packages/dom/test/css/describe.test.ts
@@ -20,7 +20,7 @@
  * under the License.
  */
 
-import { assert } from 'chai';
+import { strict as assert } from 'assert';
 import { describeCss } from '../../src/css';
 import { evaluateXPath } from '../utils';
 import { testCases } from './match-cases';
diff --git a/packages/dom/test/css/match.test.ts 
b/packages/dom/test/css/match.test.ts
index 5f38bf5..679021c 100644
--- a/packages/dom/test/css/match.test.ts
+++ b/packages/dom/test/css/match.test.ts
@@ -20,7 +20,7 @@
  * under the License.
  */
 
-import { assert } from 'chai';
+import { strict as assert } from 'assert';
 import type { CssSelector } from '@apache-annotator/selector';
 import { createCssSelectorMatcher } from '../../src/css';
 import { evaluateXPath } from '../utils';
diff --git a/packages/dom/test/highlight-text/highlight-text.test.ts 
b/packages/dom/test/highlight-text/highlight-text.test.ts
index 8591b81..ab2c43f 100644
--- a/packages/dom/test/highlight-text/highlight-text.test.ts
+++ b/packages/dom/test/highlight-text/highlight-text.test.ts
@@ -20,7 +20,7 @@
  * under the License.
  */
 
-import { assert } from 'chai';
+import { strict as assert } from 'assert';
 import { highlightText } from '../../src/highlight-text';
 import type { RangeInfo } from '../utils';
 import { hydrateRange, evaluateXPath } from '../utils';
diff --git a/packages/dom/test/range/cartesian.test.ts 
b/packages/dom/test/range/cartesian.test.ts
index f1c2d6a..d1ef0c4 100644
--- a/packages/dom/test/range/cartesian.test.ts
+++ b/packages/dom/test/range/cartesian.test.ts
@@ -20,7 +20,7 @@
  * under the License.
  */
 
-import { assert } from 'chai';
+import { strict as assert } from 'assert';
 import { cartesian } from '../../src/range/cartesian';
 
 async function* gen1() {
@@ -56,7 +56,7 @@ describe('cartesian', () => {
       actual.push(value);
     }
 
-    assert.sameDeepMembers(actual, expected, 'yields the expected items');
+    assert.deepEqual(actual, expected, 'yields the expected items');
   });
 
   it('re-raises exceptions and closes iterators', async () => {
@@ -84,7 +84,7 @@ describe('cartesian', () => {
       await cart.next();
     } catch (e) {
       assert.strictEqual(error, e, 're-raises an error from an iterable');
-      assert.isTrue(didClose, 'closes the iterators');
+      assert.strictEqual(didClose, true, 'closes the iterators');
     }
   });
 });
diff --git a/packages/dom/test/text-position/describe.test.ts 
b/packages/dom/test/text-position/describe.test.ts
index 373e153..1314447 100644
--- a/packages/dom/test/text-position/describe.test.ts
+++ b/packages/dom/test/text-position/describe.test.ts
@@ -20,7 +20,7 @@
  * under the License.
  */
 
-import { assert } from 'chai';
+import { strict as assert } from 'assert';
 import { describeTextPosition } from '../../src/text-position/describe';
 import { hydrateRange } from '../utils';
 import { testCases } from './match-cases';
diff --git a/packages/dom/test/text-position/match.test.ts 
b/packages/dom/test/text-position/match.test.ts
index 43074ce..e94161c 100644
--- a/packages/dom/test/text-position/match.test.ts
+++ b/packages/dom/test/text-position/match.test.ts
@@ -20,7 +20,7 @@
  * under the License.
  */
 
-import { assert } from 'chai';
+import { strict as assert } from 'assert';
 import type { TextPositionSelector } from '@apache-annotator/selector';
 import { createTextPositionSelectorMatcher } from 
'../../src/text-position/match';
 import { evaluateXPath, assertRangeEquals } from '../utils';
diff --git a/packages/dom/test/text-quote/describe.test.ts 
b/packages/dom/test/text-quote/describe.test.ts
index a96a430..50083fa 100644
--- a/packages/dom/test/text-quote/describe.test.ts
+++ b/packages/dom/test/text-quote/describe.test.ts
@@ -20,7 +20,7 @@
  * under the License.
  */
 
-import { assert } from 'chai';
+import { strict as assert } from 'assert';
 import { describeTextQuote } from '../../src/text-quote/describe';
 import { hydrateRange, evaluateXPath } from '../utils';
 import type { DescribeTextQuoteTestCases } from './describe-cases';
diff --git a/packages/dom/test/text-quote/match.test.ts 
b/packages/dom/test/text-quote/match.test.ts
index a1faedb..5e5e67c 100644
--- a/packages/dom/test/text-quote/match.test.ts
+++ b/packages/dom/test/text-quote/match.test.ts
@@ -20,7 +20,7 @@
  * under the License.
  */
 
-import { assert } from 'chai';
+import { strict as assert } from 'assert';
 import type { TextQuoteSelector } from '@apache-annotator/selector';
 import { createTextQuoteSelectorMatcher } from '../../src/text-quote/match';
 import { evaluateXPath, assertRangeEquals } from '../utils';
diff --git a/packages/dom/test/utils.ts b/packages/dom/test/utils.ts
index 10f8bb9..7537de7 100644
--- a/packages/dom/test/utils.ts
+++ b/packages/dom/test/utils.ts
@@ -20,7 +20,7 @@
  * under the License.
  */
 
-import { assert } from 'chai';
+import { strict as assert } from 'assert';
 import { ownerDocument } from '../src/owner-document';
 
 // RangeInfo serialises a Range’s start and end containers as XPaths.
diff --git a/test/data-model.test.ts b/test/data-model.test.ts
index 783df9f..09bae00 100644
--- a/test/data-model.test.ts
+++ b/test/data-model.test.ts
@@ -22,10 +22,10 @@
 
 /* global process */
 
+import { strict as assert } from 'assert';
 import fs from 'fs';
 import { URL } from 'url';
 import Ajv from 'ajv';
-import { assert } from 'chai';
 import fetch from 'node-fetch';
 import resolve from 'resolve';
 
@@ -101,7 +101,7 @@ describe('Test JSON against Schemas', () => {
     const schema = requireJSON(`web-annotation-tests/${schemaPath}`);
     it(schema['title'] as string, () => {
       const valid = ajv.validate(schema, data);
-      assert.isOk(valid, ajv.errorsText());
+      assert.ok(valid, ajv.errorsText());
     });
   });
 });
diff --git a/yarn.lock b/yarn.lock
index 45bdeea..61b2328 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1788,11 +1788,6 @@
   dependencies:
     any-observable "^0.3.0"
 
-"@types/chai@^4.2.11":
-  version "4.2.11"
-  resolved 
"https://registry.yarnpkg.com/@types/chai/-/chai-4.2.11.tgz#d3614d6c5f500142358e6ed24e1bf16657536c50";
-  integrity 
sha512-t7uW6eFafjO+qJ3BIV2gGUyZs27egcNRkUdalkud+Qa3+kg//f129iuOFivHDXQ+vnU3fDXuwgv0cqMCbcE8sw==
-
 "@types/color-name@^1.1.1":
   version "1.1.1"
   resolved 
"https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0";
@@ -2474,11 +2469,6 @@ assert@^1.1.1:
     object-assign "^4.1.1"
     util "0.10.3"
 
-assertion-error@^1.1.0:
-  version "1.1.0"
-  resolved 
"https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b";
-  integrity 
sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==
-
 assign-symbols@^1.0.0:
   version "1.0.0"
   resolved 
"https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367";
@@ -3008,18 +2998,6 @@ caseless@~0.12.0:
   resolved 
"https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc";
   integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
 
-chai@^4.2.0:
-  version "4.2.0"
-  resolved 
"https://registry.yarnpkg.com/chai/-/chai-4.2.0.tgz#760aa72cf20e3795e84b12877ce0e83737aa29e5";
-  integrity 
sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==
-  dependencies:
-    assertion-error "^1.1.0"
-    check-error "^1.0.2"
-    deep-eql "^3.0.1"
-    get-func-name "^2.0.0"
-    pathval "^1.1.0"
-    type-detect "^4.0.5"
-
 [email protected], chalk@^2.0.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2:
   version "2.4.2"
   resolved 
"https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424";
@@ -3061,11 +3039,6 @@ chardet@^0.7.0:
   resolved 
"https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e";
   integrity 
sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==
 
-check-error@^1.0.2:
-  version "1.0.2"
-  resolved 
"https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82";
-  integrity sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=
-
 [email protected]:
   version "3.5.2"
   resolved 
"https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75";
@@ -3803,13 +3776,6 @@ dedent@^0.7.0:
   resolved 
"https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c";
   integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=
 
-deep-eql@^3.0.1:
-  version "3.0.1"
-  resolved 
"https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df";
-  integrity 
sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==
-  dependencies:
-    type-detect "^4.0.0"
-
 deep-equal@^1.0.1:
   version "1.1.0"
   resolved 
"https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.1.0.tgz#3103cdf8ab6d32cf4a8df7865458f2b8d33f3745";
@@ -5028,11 +4994,6 @@ get-caller-file@^2.0.1, get-caller-file@^2.0.5:
   resolved 
"https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e";
   integrity 
sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
 
-get-func-name@^2.0.0:
-  version "2.0.0"
-  resolved 
"https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41";
-  integrity sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=
-
 get-own-enumerable-property-symbols@^3.0.0:
   version "3.0.0"
   resolved 
"https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.0.tgz#b877b49a5c16aefac3655f2ed2ea5b684df8d203";
@@ -7901,11 +7862,6 @@ path-type@^4.0.0:
   resolved 
"https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b";
   integrity 
sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==
 
-pathval@^1.1.0:
-  version "1.1.0"
-  resolved 
"https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0";
-  integrity sha1-uULm1L3mUwBe9rcTYd74cn0GReA=
-
 pbkdf2@^3.0.3:
   version "3.0.17"
   resolved 
"https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6";
@@ -9732,11 +9688,6 @@ type-check@~0.3.2:
   dependencies:
     prelude-ls "~1.1.2"
 
-type-detect@^4.0.0, type-detect@^4.0.5:
-  version "4.0.8"
-  resolved 
"https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c";
-  integrity 
sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
-
 type-fest@^0.3.0:
   version "0.3.1"
   resolved 
"https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1";

Reply via email to