Convert tests to typescript

Chai’s assert was used as a global in the tests; I did not directly see
a way to make typescript understand that, so I just import { assert } in
the tests (seems a cleaner practice to me anyhow, I would not mind doing
this for describe etc too).
diff --git a/.mocharc.js b/.mocharc.js
index 2200690..a6239f7 100644
--- a/.mocharc.js
+++ b/.mocharc.js
@@ -19,5 +19,5 @@
  */
 
 module.exports = {
-  require: ['./babel-register.js', 'chai/register-assert'],
+  require: ['./babel-register.js'],
 };
diff --git a/package.json b/package.json
index 2edc39b..1b236ec 100644
--- a/package.json
+++ b/package.json
@@ -38,6 +38,10 @@
     "@babel/preset-env": "^7.10.1",
     "@babel/preset-typescript": "^7.10.1",
     "@babel/register": "^7.10.1",
+    "@types/chai": "^4.2.11",
+    "@types/mocha": "^7.0.2",
+    "@types/node-fetch": "^2.5.7",
+    "@types/resolve": "^1.17.0",
     "ajv": "^6.11.0",
     "babel-eslint": "^10.0.3",
     "babel-loader": "^8.0.5",
diff --git a/packages/dom/test/cartesian.js b/packages/dom/test/cartesian.ts
similarity index 95%
rename from packages/dom/test/cartesian.js
rename to packages/dom/test/cartesian.ts
index c5cfd23..9ff47eb 100644
--- a/packages/dom/test/cartesian.js
+++ b/packages/dom/test/cartesian.ts
@@ -18,6 +18,7 @@
  * under the License.
  */
 
+import { assert } from 'chai';
 import { product } from '../src/cartesian';
 
 async function* gen1() {
@@ -49,7 +50,7 @@
         [3, 4, 6],
       ];
 
-      const result = [];
+      const result: number[][] = [];
       for await (let value of cart) {
         result.push(value);
       }
diff --git a/test/data-model.js b/test/data-model.ts
similarity index 92%
rename from test/data-model.js
rename to test/data-model.ts
index 8398e40..975b361 100644
--- a/test/data-model.js
+++ b/test/data-model.ts
@@ -25,6 +25,7 @@
 
 import Ajv from 'ajv';
 import META_SCHEMA from 'ajv/lib/refs/json-schema-draft-04.json';
+import { assert } from 'chai';
 import fetch from 'node-fetch';
 import resolve from 'resolve';
 
@@ -44,11 +45,11 @@
   }
 });
 
-function readSchema(schemaPath, base = 'web-annotation-tests/') {
+function readSchema(schemaPath: string, base: string = 'web-annotation-tests/'): any {
   const resolverOptions = { extensions: ['.json', '.test'] };
   const resolvedPath = resolve.sync(`${base}${schemaPath}`, resolverOptions);
   const schemaUnparsed = fs.readFileSync(resolvedPath);
-  return JSON.parse(schemaUnparsed);
+  return JSON.parse(schemaUnparsed.toString());
 }
 
 const DEFINITIONS = [
@@ -89,7 +90,7 @@
     }
   });
 
-  MUSTS.assertions.forEach(schemaPath => {
+  MUSTS.assertions.forEach((schemaPath: string) => {
     const schema = readSchema(schemaPath);
     it(schema.title, () => {
       let valid = ajv.validate(schema, data);
diff --git a/yarn.lock b/yarn.lock
index 724132d..2cb91e5 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1892,6 +1892,11 @@
   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"
@@ -1916,6 +1921,19 @@
   resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
   integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
 
+"@types/mocha@^7.0.2":
+  version "7.0.2"
+  resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-7.0.2.tgz#b17f16cf933597e10d6d78eae3251e692ce8b0ce"
+  integrity sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w==
+
+"@types/node-fetch@^2.5.7":
+  version "2.5.7"
+  resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.7.tgz#20a2afffa882ab04d44ca786449a276f9f6bbf3c"
+  integrity sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==
+  dependencies:
+    "@types/node" "*"
+    form-data "^3.0.0"
+
 "@types/node@*":
   version "12.7.8"
   resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.8.tgz#cb1bf6800238898bc2ff6ffa5702c3cadd350708"
@@ -1926,6 +1944,13 @@
   resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
   integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==
 
+"@types/resolve@^1.17.0":
+  version "1.17.0"
+  resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.0.tgz#eb25b38e2682f641d33841df162e052d7364eaa8"
+  integrity sha512-CKOBcXAHvoGEjYsg6Bkc/kLPqTmtnUEGrWnJJC6LNnk+D36uc1GAHcNnwK2g58x/JWjGlqGfIao9rsJk7LePWw==
+  dependencies:
+    "@types/node" "*"
+
 "@webassemblyjs/ast@1.8.5":
   version "1.8.5"
   resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359"
@@ -3209,7 +3234,7 @@
     strip-ansi "^3.0.0"
     wcwidth "^1.0.0"
 
-combined-stream@^1.0.6, combined-stream@~1.0.6:
+combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6:
   version "1.0.8"
   resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
   integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
@@ -4765,6 +4790,15 @@
   resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
   integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=
 
+form-data@^3.0.0:
+  version "3.0.0"
+  resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.0.tgz#31b7e39c85f1355b7139ee0c647cf0de7f83c682"
+  integrity sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==
+  dependencies:
+    asynckit "^0.4.0"
+    combined-stream "^1.0.8"
+    mime-types "^2.1.12"
+
 form-data@~2.3.2:
   version "2.3.3"
   resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6"