From 62375c907f2579873e590e2f05767ae6157bbc7b Mon Sep 17 00:00:00 2001 From: Christina Wang Date: Fri, 7 May 2021 01:47:10 +0000 Subject: [PATCH] Upgrade mocha to v8, use mocha fixtures for chai plugins Remove chai-events and add explicit chai devDependency Change-type: patch Signed-off-by: Christina Wang --- package-lock.json | 790 +++++++++++++++++++++------- package.json | 28 +- test/.mocharc.fast.js | 12 + test/.mocharc.js | 11 + test/00-init.spec.ts | 2 +- test/03-config.spec.ts | 6 +- test/04-service.spec.ts | 14 +- test/05-device-state.spec.ts | 6 +- test/08-event-tracker.spec.ts | 3 +- test/10-api-binder.spec.ts | 7 +- test/12-device-config.spec.ts | 2 +- test/13-application-manager.spec.ts | 6 +- test/16-config-utils.spec.ts | 2 +- test/20-compose-volume.spec.ts | 1 - test/22-local-mode.spec.ts | 17 +- test/23-contracts.spec.ts | 6 +- test/25-journald.spec.ts | 3 +- test/27-extlinux-config.spec.ts | 2 +- test/28-db-format.spec.ts | 2 +- test/29-append-directive.spec.ts | 2 +- test/30-fdt-directive.spec.ts | 2 +- test/32-compose-app-manager.spec.ts | 6 - test/33-extra-uenv-config.spec.ts | 2 +- test/37-odmdata-config.spec.ts | 3 +- test/39-compose-commit.spec.ts | 1 + test/39-compose-images.spec.ts | 6 +- test/40-target-state.spec.ts | 3 +- test/44-volume-manager.spec.ts | 2 +- test/config/fixtures.ts | 25 + test/fast-mocha.opts | 5 - test/lib/chai-config.ts | 8 - test/lib/mocked-event-tracker.ts | 4 - test/mocha.opts | 3 - 33 files changed, 701 insertions(+), 291 deletions(-) create mode 100644 test/.mocharc.fast.js create mode 100644 test/.mocharc.js create mode 100644 test/config/fixtures.ts delete mode 100644 test/fast-mocha.opts delete mode 100644 test/lib/chai-config.ts delete mode 100644 test/lib/mocked-event-tracker.ts delete mode 100644 test/mocha.opts diff --git a/package-lock.json b/package-lock.json index 86e82623..187d86a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -354,41 +354,32 @@ "dev": true }, "@sinonjs/commons": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.1.tgz", - "integrity": "sha512-Debi3Baff1Qu1Unc3mjJ96MgpbwTn43S1+9yJ0llWygPwDNu2aaWBD6yc9y/Z8XDRNhx7U+u2UDg2OGQXkclUQ==", + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", + "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==", "dev": true, "requires": { "type-detect": "4.0.8" - }, - "dependencies": { - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - } } }, - "@sinonjs/formatio": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.2.tgz", - "integrity": "sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==", + "@sinonjs/fake-timers": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-7.0.5.tgz", + "integrity": "sha512-fUt6b15bjV/VW93UP5opNXJxdwZSbK1EdiwnhN7XrQrcpaOhMJpZ/CjwFpM3THpxwA+YviBUJKSuEqKlCK5alw==", "dev": true, "requires": { - "@sinonjs/commons": "^1", - "@sinonjs/samsam": "^3.1.0" + "@sinonjs/commons": "^1.7.0" } }, "@sinonjs/samsam": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.3.tgz", - "integrity": "sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.3.1.tgz", + "integrity": "sha512-1Hc0b1TtyfBu8ixF/tpfSHTVWKwCBLY4QJbkgnE7HcwyvT2xArDxb4K7dMgqRm3szI+LJbzmW/s4xxEhv6hwDg==", "dev": true, "requires": { - "@sinonjs/commons": "^1.3.0", - "array-from": "^2.1.1", - "lodash": "^4.17.15" + "@sinonjs/commons": "^1.6.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" } }, "@sinonjs/text-encoding": { @@ -435,9 +426,9 @@ "dev": true }, "@types/chai": { - "version": "4.2.12", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.12.tgz", - "integrity": "sha512-aN5IAC8QNtSUdQzxu7lGBgYAOuU1tmRU4c9dIq5OKGf/SBVjXo+ffM2wEjudAWbgpOhy60nLoAGH1xm8fpCKFQ==", + "version": "4.2.16", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.16.tgz", + "integrity": "sha512-vI5iOAsez9+roLS3M3+Xx7w+WRuDtSmF8bQkrbcIJ2sC1PcDgVoA0WGpa+bIrJ+y8zqY2oi//fUctkxtIcXJCw==", "dev": true }, "@types/chai-as-promised": { @@ -489,9 +480,9 @@ } }, "@types/cookiejar": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.1.tgz", - "integrity": "sha512-aRnpPa7ysx3aNW60hTiCtLHlQaIFsXFCgQlpakNgDNVFzbtusSY8PwjAQgRWfSk0ekNoBjO51eQRB6upA9uuyw==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog==", "dev": true }, "@types/copy-webpack-plugin": { @@ -645,9 +636,9 @@ "dev": true }, "@types/mocha": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", - "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.2.tgz", + "integrity": "sha512-Lwh0lzzqT5Pqh6z61P3c3P5nm6fzQK/MMHl9UKeneAeInVflBSz1O2EkX6gM6xfJd7FBXBY5purtLx7fUiZ7Hw==", "dev": true }, "@types/mock-fs": { @@ -770,15 +761,18 @@ "dev": true }, "@types/sinon": { - "version": "7.5.2", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-7.5.2.tgz", - "integrity": "sha512-T+m89VdXj/eidZyejvmoP9jivXgBDdkOSBVQjU9kF349NEx10QdPNGxHeZUaj1IlJ32/ewdyXJjnJxyxJroYwg==", - "dev": true + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.0.tgz", + "integrity": "sha512-jDZ55oCKxqlDmoTBBbBBEx+N8ZraUVhggMZ9T5t+6/Dh8/4NiOjSUfpLrPiEwxQDlAe3wpAkoXhWvE6LibtsMQ==", + "dev": true, + "requires": { + "@sinonjs/fake-timers": "^7.0.4" + } }, "@types/sinon-chai": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@types/sinon-chai/-/sinon-chai-3.2.4.tgz", - "integrity": "sha512-xq5KOWNg70PRC7dnR2VOxgYQ6paumW+4pTZP+6uTSdhpYsAUEeeT5bw6rRHHQrZ4KyR+M5ojOR+lje6TGSpUxA==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/@types/sinon-chai/-/sinon-chai-3.2.5.tgz", + "integrity": "sha512-bKQqIpew7mmIGNRlxW6Zli/QVyc3zikpGzCa797B/tRnD9OtHvZ/ts8sYXV+Ilj9u3QRaUEM8xrjgd1gwm1BpQ==", "dev": true, "requires": { "@types/chai": "*", @@ -792,9 +786,9 @@ "dev": true }, "@types/superagent": { - "version": "4.1.9", - "resolved": "https://registry.npmjs.org/@types/superagent/-/superagent-4.1.9.tgz", - "integrity": "sha512-gpIC0p49YHT4VYDbdl0fKjOMWBurJFfYtKUIxOHzOwBtu5VT29FyldFI2vbmZ1K2iH2vS6MVcJZMjHM+652l4Q==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@types/superagent/-/superagent-4.1.10.tgz", + "integrity": "sha512-xAgkb2CMWUMCyVc/3+7iQfOEBE75NvuZeezvmixbUw3nmENf2tCnQkW5yQLTYqvXUQ+R6EXxdqKKbal2zM5V/g==", "dev": true, "requires": { "@types/cookiejar": "*", @@ -802,9 +796,9 @@ } }, "@types/supertest": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@types/supertest/-/supertest-2.0.10.tgz", - "integrity": "sha512-Xt8TbEyZTnD5Xulw95GLMOkmjGICrOQyJ2jqgkSjAUR3mm7pAIzSR0NFBaMcwlzVvlpCjNwbATcWWwjNiZiFrQ==", + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/supertest/-/supertest-2.0.11.tgz", + "integrity": "sha512-uci4Esokrw9qGb9bvhhSVEjd6rkny/dk5PK/Qz4yxKiyppEI+dOPlNrZBahE3i+PoKFYyDxChVXZ/ysS/nrm1Q==", "dev": true, "requires": { "@types/superagent": "*" @@ -910,6 +904,12 @@ "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", "dev": true }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, "@webassemblyjs/ast": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz", @@ -1268,9 +1268,9 @@ "dev": true }, "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", "dev": true, "requires": { "normalize-path": "^3.0.0", @@ -1336,12 +1336,6 @@ "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", "dev": true }, - "array-from": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", - "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=", - "dev": true - }, "array-slice": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", @@ -1611,9 +1605,9 @@ "dev": true }, "binary-extensions": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", - "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, "bindings": { @@ -2148,6 +2142,16 @@ } } }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, "call-me-maybe": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", @@ -2198,14 +2202,17 @@ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, "chai": { - "version": "3.5.0", - "resolved": "http://registry.npmjs.org/chai/-/chai-3.5.0.tgz", - "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", "dev": true, "requires": { - "assertion-error": "^1.0.1", - "deep-eql": "^0.1.3", - "type-detect": "^1.0.0" + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" } }, "chai-as-promised": { @@ -2217,15 +2224,6 @@ "check-error": "^1.0.2" } }, - "chai-events": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/chai-events/-/chai-events-0.0.1.tgz", - "integrity": "sha1-+BxrbSsaoUWPYsCt7Ji22QokZAw=", - "dev": true, - "requires": { - "chai": "^3.5.0" - } - }, "chai-like": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/chai-like/-/chai-like-1.1.1.tgz", @@ -2262,19 +2260,19 @@ "dev": true }, "chokidar": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", - "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", "dev": true, "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.1.2", + "fsevents": "~2.3.1", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.4.0" + "readdirp": "~3.5.0" }, "dependencies": { "braces": { @@ -3067,20 +3065,12 @@ "dev": true }, "deep-eql": { - "version": "0.1.3", - "resolved": "http://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", - "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "dev": true, "requires": { - "type-detect": "0.1.1" - }, - "dependencies": { - "type-detect": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", - "integrity": "sha1-C6XsKohWQORw6k6FBZcZANrFiCI=", - "dev": true - } + "type-detect": "^4.0.0" } }, "deep-extend": { @@ -3286,9 +3276,9 @@ "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" }, "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", "dev": true }, "diffie-hellman": { @@ -3765,6 +3755,12 @@ "es6-symbol": "^3.1.1" } }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, "escape-goat": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", @@ -4621,6 +4617,12 @@ "integrity": "sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==", "dev": true }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true + }, "flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", @@ -4887,12 +4889,18 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", - "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "optional": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -4920,6 +4928,23 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, "get-own-enumerable-property-symbols": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz", @@ -5132,12 +5157,27 @@ "har-schema": "^2.0.0" } }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "dev": true + }, "has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", @@ -5860,6 +5900,12 @@ "integrity": "sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==", "dev": true }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true + }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -6142,9 +6188,9 @@ } }, "just-extend": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.0.tgz", - "integrity": "sha512-ApcjaOdVTJ7y4r08xI5wIqpvwS48Q0PBG4DJROcEkH1f8MdAiNFyFxz3xoL0LWAVwjrwPYZdVHHxhRHcx/uGLA==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", + "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", "dev": true }, "keyv": { @@ -6545,6 +6591,12 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", + "dev": true + }, "log-symbols": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", @@ -6683,12 +6735,6 @@ } } }, - "lolex": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz", - "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==", - "dev": true - }, "lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", @@ -7081,43 +7127,122 @@ } }, "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.3.2.tgz", + "integrity": "sha512-UdmISwr/5w+uXLPKspgoV7/RXZwKRTiTjJ2/AC5ZiEztIoOYdfKb19+9jNmEInzx5pBsCyJQzarAxqIGBNYJhg==", "dev": true, "requires": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", + "chokidar": "3.5.1", + "debug": "4.3.1", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.6", "growl": "1.10.5", - "he": "1.1.1", + "he": "1.2.0", + "js-yaml": "4.0.0", + "log-symbols": "4.0.0", "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" + "ms": "2.1.3", + "nanoid": "3.1.20", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.1.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" }, "dependencies": { - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "2.1.2" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" } }, "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -7128,14 +7253,162 @@ "path-is-absolute": "^1.0.0" } }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "js-yaml": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", "dev": true, "requires": { - "minimist": "0.0.8" + "argparse": "^2.0.1" } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true } } }, @@ -7217,6 +7490,12 @@ "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" }, + "nanoid": { + "version": "3.1.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", + "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", + "dev": true + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -7303,33 +7582,33 @@ "dev": true }, "nise": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", - "integrity": "sha512-Ymbac/94xeIrMf59REBPOv0thr+CJVFMhrlAkW/gjCIE58BGQdCj0x7KRCb3yz+Ga2Rz3E9XXSvUyyxqqhjQAQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/nise/-/nise-4.1.0.tgz", + "integrity": "sha512-eQMEmGN/8arp0xsvGoQ+B1qvSkR73B1nWSCh7nOt5neMCtwcQVYQGdzQMhcNscktTsWB54xnlSQFzOAPJD8nXA==", "dev": true, "requires": { - "@sinonjs/formatio": "^3.2.1", + "@sinonjs/commons": "^1.7.0", + "@sinonjs/fake-timers": "^6.0.0", "@sinonjs/text-encoding": "^0.7.1", "just-extend": "^4.0.2", - "lolex": "^5.0.1", "path-to-regexp": "^1.7.0" }, "dependencies": { + "@sinonjs/fake-timers": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-6.0.1.tgz", + "integrity": "sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0" + } + }, "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, - "lolex": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", - "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", - "dev": true, - "requires": { - "@sinonjs/commons": "^1.7.0" - } - }, "path-to-regexp": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", @@ -7604,6 +7883,12 @@ "integrity": "sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA==", "dev": true }, + "object-inspect": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", + "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", + "dev": true + }, "object-visit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", @@ -7958,6 +8243,12 @@ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true + }, "pause-stream": { "version": "0.0.11", "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", @@ -8319,18 +8610,18 @@ } }, "readdirp": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", - "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", "dev": true, "requires": { "picomatch": "^2.2.1" }, "dependencies": { "picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", + "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", "dev": true } } @@ -8900,6 +9191,17 @@ "integrity": "sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==", "dev": true }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -8940,35 +9242,55 @@ } }, "sinon": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.5.0.tgz", - "integrity": "sha512-AoD0oJWerp0/rY9czP/D6hDTTUYGpObhZjMpd7Cl/A6+j0xBE+ayL/ldfggkBXUs0IkvIiM1ljM8+WkOc5k78Q==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-10.0.0.tgz", + "integrity": "sha512-XAn5DxtGVJBlBWYrcYKEhWCz7FLwZGdyvANRyK06419hyEpdT0dMc5A8Vcxg5SCGHc40CsqoKsc1bt1CbJPfNw==", "dev": true, "requires": { - "@sinonjs/commons": "^1.4.0", - "@sinonjs/formatio": "^3.2.1", - "@sinonjs/samsam": "^3.3.3", - "diff": "^3.5.0", - "lolex": "^4.2.0", - "nise": "^1.5.2", - "supports-color": "^5.5.0" + "@sinonjs/commons": "^1.8.1", + "@sinonjs/fake-timers": "^6.0.1", + "@sinonjs/samsam": "^5.3.1", + "diff": "^4.0.2", + "nise": "^4.1.0", + "supports-color": "^7.1.0" }, "dependencies": { - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "@sinonjs/fake-timers": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-6.0.1.tgz", + "integrity": "sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "@sinonjs/commons": "^1.7.0" + } + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" } } } }, "sinon-chai": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/sinon-chai/-/sinon-chai-3.5.0.tgz", - "integrity": "sha512-IifbusYiQBpUxxFJkR3wTU68xzBN0+bxCScEaKMjBvAQERg6FnTTc1F17rseLb1tjmkJ23730AXpFI0c47FgAg==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/sinon-chai/-/sinon-chai-3.6.0.tgz", + "integrity": "sha512-bk2h+0xyKnmvazAnc7HE5esttqmCerSMcBtuB2PS2T4tG6x8woXAxZeJaOJWD+8reXHngnXn0RtIbfEW9OTHFg==", "dev": true }, "skhema": { @@ -9411,48 +9733,92 @@ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, "superagent": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-3.8.3.tgz", - "integrity": "sha512-GLQtLMCoEIK4eDv6OGtkOoSMt3D+oq0y3dsxMuYuDvaNUvuT8eFBuLmfR0iYYzHC1e8hpzC6ZsxbuP6DIalMFA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-6.1.0.tgz", + "integrity": "sha512-OUDHEssirmplo3F+1HWKUrUjvnQuA+nZI6i/JJBdXb5eq9IyEQwPyPpqND+SSsxf6TygpBEkUjISVRN4/VOpeg==", "dev": true, "requires": { - "component-emitter": "^1.2.0", - "cookiejar": "^2.1.0", - "debug": "^3.1.0", - "extend": "^3.0.0", - "form-data": "^2.3.1", - "formidable": "^1.2.0", - "methods": "^1.1.1", - "mime": "^1.4.1", - "qs": "^6.5.1", - "readable-stream": "^2.3.5" + "component-emitter": "^1.3.0", + "cookiejar": "^2.1.2", + "debug": "^4.1.1", + "fast-safe-stringify": "^2.0.7", + "form-data": "^3.0.0", + "formidable": "^1.2.2", + "methods": "^1.1.2", + "mime": "^2.4.6", + "qs": "^6.9.4", + "readable-stream": "^3.6.0", + "semver": "^7.3.2" }, "dependencies": { + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", + "dev": true + }, "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, + "form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "mime": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", + "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==", + "dev": true + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true + }, + "qs": { + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", + "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", + "dev": true, + "requires": { + "side-channel": "^1.0.4" + } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } } } }, "supertest": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/supertest/-/supertest-4.0.2.tgz", - "integrity": "sha512-1BAbvrOZsGA3YTCWqbmh14L0YEq0EGICX/nBnfkfVJn7SrxQV1I3pMYjSzG9y/7ZU2V9dWqyqk2POwxlb09duQ==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/supertest/-/supertest-6.1.3.tgz", + "integrity": "sha512-v2NVRyP73XDewKb65adz+yug1XMtmvij63qIWHZzSX8tp6wiq6xBLUy4SUAd2NII6wIipOmHT/FD9eicpJwdgQ==", "dev": true, "requires": { "methods": "^1.1.2", - "superagent": "^3.8.3" + "superagent": "^6.1.0" } }, "supports-color": { @@ -10158,9 +10524,9 @@ } }, "type-detect": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz", - "integrity": "sha1-diIXzAbbJY7EiQihKY6LlRIejqI=", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, "type-fest": { @@ -11315,6 +11681,12 @@ "errno": "~0.1.7" } }, + "workerpool": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz", + "integrity": "sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==", + "dev": true + }, "wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -11527,11 +11899,43 @@ "decamelize": "^1.2.0" } }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "dependencies": { + "camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + } + } + }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true } } } diff --git a/package.json b/package.json index 9d6f1549..5033cd3b 100644 --- a/package.json +++ b/package.json @@ -14,10 +14,10 @@ "lint": "balena-lint -e ts -e js --typescript src/ test/ typings/ build-utils/ webpack.config.js && tsc --noEmit && tsc --noEmit --project tsconfig.js.json", "test": "npm run clean && npm run test-nolint", "posttest": "npm run lint", - "test-nolint": "npm run test:build && TEST=1 mocha", + "test-nolint": "npm run test:build && TEST=1 mocha --config test/.mocharc.js", "test:build": "npm run test-build && npm run testitems:copy && npm run packagejson:copy", - "test:fast": "TEST=1 mocha --opts test/fast-mocha.opts", - "test:debug": "npm run test:build && TEST=1 mocha --inspect-brk", + "test:fast": "TEST=1 mocha --config test/.mocharc.fast.js", + "test:debug": "npm run test:build && TEST=1 mocha --inspect-brk --config test/.mocharc.js", "prettify": "balena-lint -e ts -e js --typescript --fix src/ test/ typings/ build-utils/ webpack.config.js", "test-build": "tsc --project tsconfig.json", "release": "tsc --project tsconfig.release.json && mv build/src/* build", @@ -42,7 +42,7 @@ "@balena/contrato": "^0.6.0", "@balena/lint": "^5.1.0", "@types/bluebird": "^3.5.32", - "@types/chai": "^4.2.12", + "@types/chai": "^4.2.16", "@types/chai-as-promised": "^7.1.3", "@types/chai-like": "^1.1.0", "@types/chai-things": "0.0.34", @@ -55,7 +55,7 @@ "@types/lockfile": "^1.0.1", "@types/lodash": "^4.14.159", "@types/memoizee": "^0.4.4", - "@types/mocha": "^5.2.7", + "@types/mocha": "^8.2.2", "@types/mock-fs": "^4.13.0", "@types/morgan": "^1.9.0", "@types/node": "^12.12.54", @@ -65,9 +65,9 @@ "@types/rwlock": "^5.0.2", "@types/semver": "^7.3.3", "@types/shell-quote": "^1.7.0", - "@types/sinon": "^7.5.2", - "@types/sinon-chai": "^3.2.4", - "@types/supertest": "^2.0.10", + "@types/sinon": "^10.0.0", + "@types/sinon-chai": "^3.2.5", + "@types/supertest": "^2.0.11", "@types/terser-webpack-plugin": "^3.0.0", "@types/tmp": "^0.1.0", "@types/webpack": "^4.41.21", @@ -75,11 +75,11 @@ "balena-register-device": "^7.2.0", "blinking": "^0.0.4", "bluebird": "^3.7.2", + "chai": "^4.3.4", "chai-as-promised": "^7.1.1", - "chai-events": "0.0.1", "chai-like": "^1.1.1", "chai-things": "^0.2.0", - "chokidar": "^3.4.2", + "chokidar": "^3.5.1", "common-tags": "^1.8.0", "copy-webpack-plugin": "^6.0.3", "deep-object-diff": "^1.1.0", @@ -103,7 +103,7 @@ "lodash": "^4.17.21", "memoizee": "^0.4.14", "mixpanel": "^0.10.3", - "mocha": "^5.2.0", + "mocha": "^8.3.2", "mock-fs": "^4.14.0", "morgan": "^1.10.0", "network-checker": "^0.1.1", @@ -117,10 +117,10 @@ "rimraf": "^2.7.1", "rwlock": "^5.0.0", "shell-quote": "^1.7.2", - "sinon": "^7.5.0", - "sinon-chai": "^3.5.0", + "sinon": "^10.0.0", + "sinon-chai": "^3.6.0", "strict-event-emitter-types": "^2.0.0", - "supertest": "^4.0.2", + "supertest": "^6.1.3", "tar-stream": "^2.1.3", "terser-webpack-plugin": "^4.1.0", "tmp": "^0.1.0", diff --git a/test/.mocharc.fast.js b/test/.mocharc.fast.js new file mode 100644 index 00000000..bb81f4a4 --- /dev/null +++ b/test/.mocharc.fast.js @@ -0,0 +1,12 @@ +module.exports = { + bail: true, // Exit test script on first error + exit: true, // Force Mocha to exit after tests complete + recursive: true, // Look for tests in subdirectories + require: [ + // Files to execute before running suites + 'ts-node/register/transpile-only', + 'test/config/fixtures.ts', + ], + spec: ['test/**/*.spec.ts'], + timeout: '30000', +}; diff --git a/test/.mocharc.js b/test/.mocharc.js new file mode 100644 index 00000000..45196be2 --- /dev/null +++ b/test/.mocharc.js @@ -0,0 +1,11 @@ +module.exports = { + bail: true, // Exit test script on first error + exit: true, // Force Mocha to exit after tests complete + recursive: true, // Look for tests in subdirectories + require: [ + // Files to execute before running suites + 'build/test/config/fixtures.js', + ], + spec: ['build/test/**/*.spec.js'], + timeout: '30000', +}; diff --git a/test/00-init.spec.ts b/test/00-init.spec.ts index ddf81ce7..f0e16e2b 100644 --- a/test/00-init.spec.ts +++ b/test/00-init.spec.ts @@ -1,6 +1,7 @@ process.env.ROOT_MOUNTPOINT = './test/data'; process.env.BOOT_MOUNTPOINT = '/mnt/boot'; process.env.CONFIG_JSON_PATH = '/config.json'; +process.env.CONFIG_MOUNT_POINT = './test/data/config.json'; process.env.DATABASE_PATH = './test/data/database.sqlite'; process.env.DATABASE_PATH_2 = './test/data/database2.sqlite'; process.env.DATABASE_PATH_3 = './test/data/database3.sqlite'; @@ -33,4 +34,3 @@ fs.writeFileSync( import './lib/mocked-dbus'; import './lib/mocked-dockerode'; import './lib/mocked-iptables'; -import './lib/mocked-event-tracker'; diff --git a/test/03-config.spec.ts b/test/03-config.spec.ts index d0393990..5ccb77df 100644 --- a/test/03-config.spec.ts +++ b/test/03-config.spec.ts @@ -1,8 +1,8 @@ import * as _ from 'lodash'; import { promises as fs } from 'fs'; import { SinonStub, stub } from 'sinon'; +import { expect } from 'chai'; -import * as chai from 'chai'; import prepare = require('./lib/prepare'); import * as conf from '../src/config'; @@ -10,10 +10,6 @@ import constants = require('../src/lib/constants'); import { SchemaTypeKey } from '../src/config/schema-type'; import { fnSchema } from '../src/config/functions'; -// tslint:disable-next-line -chai.use(require('chai-events')); -const { expect } = chai; - describe('Config', () => { before(async () => { await prepare(); diff --git a/test/04-service.spec.ts b/test/04-service.spec.ts index 4085484e..c89fc5e5 100644 --- a/test/04-service.spec.ts +++ b/test/04-service.spec.ts @@ -1,7 +1,5 @@ import * as _ from 'lodash'; - -import ChaiConfig = require('./lib/chai-config'); -const { assert, expect } = ChaiConfig; +import { expect } from 'chai'; import Service from '../src/compose/service'; import { @@ -315,7 +313,7 @@ describe('compose/service', () => { }, { appName: 'test' } as any, ); - assert(svc1.isEqualConfig(svc2, {})); + expect(svc1.isEqualConfig(svc2, {})).to.be.true; svc2 = await Service.fromComposeObject( { @@ -326,7 +324,7 @@ describe('compose/service', () => { }, { appName: 'test' } as any, ); - assert(!svc1.isEqualConfig(svc2, {})); + expect(svc1.isEqualConfig(svc2, {})).to.be.false; }); it('should correctly compare non-ordered array parameters', async () => { @@ -348,7 +346,7 @@ describe('compose/service', () => { }, { appName: 'test' } as any, ); - assert(svc1.isEqualConfig(svc2, {})); + expect(svc1.isEqualConfig(svc2, {})).to.be.true; svc2 = await Service.fromComposeObject( { @@ -359,7 +357,7 @@ describe('compose/service', () => { }, { appName: 'test' } as any, ); - assert(svc1.isEqualConfig(svc2, {})); + expect(svc1.isEqualConfig(svc2, {})).to.be.true; }); it('should correctly compare both ordered and non-ordered array parameters', async () => { @@ -383,7 +381,7 @@ describe('compose/service', () => { }, { appName: 'test' } as any, ); - assert(svc1.isEqualConfig(svc2, {})); + expect(svc1.isEqualConfig(svc2, {})).to.be.true; }); }); diff --git a/test/05-device-state.spec.ts b/test/05-device-state.spec.ts index 0b482f3f..681f96fa 100644 --- a/test/05-device-state.spec.ts +++ b/test/05-device-state.spec.ts @@ -1,7 +1,7 @@ import * as _ from 'lodash'; import { stub } from 'sinon'; +import { expect } from 'chai'; -import * as chai from 'chai'; import { StatusCodeError } from '../src/lib/errors'; import prepare = require('./lib/prepare'); import * as dockerUtils from '../src/lib/docker-utils'; @@ -14,10 +14,6 @@ import { loadTargetFromFile } from '../src/device-state/preload'; import Service from '../src/compose/service'; import { intialiseContractRequirements } from '../src/lib/contracts'; -// tslint:disable-next-line -chai.use(require('chai-events')); -const { expect } = chai; - const mockedInitialConfig = { RESIN_SUPERVISOR_CONNECTIVITY_CHECK: 'true', RESIN_SUPERVISOR_DELTA: 'false', diff --git a/test/08-event-tracker.spec.ts b/test/08-event-tracker.spec.ts index b8ae5fc9..298cedce 100644 --- a/test/08-event-tracker.spec.ts +++ b/test/08-event-tracker.spec.ts @@ -1,7 +1,6 @@ -import * as mixpanel from 'mixpanel'; import { SinonStub, stub, spy, SinonSpy } from 'sinon'; - import { expect } from 'chai'; +import * as mixpanel from 'mixpanel'; import log from '../src/lib/supervisor-console'; import supervisorVersion = require('../src/lib/supervisor-version'); diff --git a/test/10-api-binder.spec.ts b/test/10-api-binder.spec.ts index fa5b77b8..6696f258 100644 --- a/test/10-api-binder.spec.ts +++ b/test/10-api-binder.spec.ts @@ -2,12 +2,12 @@ import { stripIndent } from 'common-tags'; import { promises as fs } from 'fs'; import { Server } from 'net'; import { SinonSpy, SinonStub, spy, stub } from 'sinon'; +import { expect } from 'chai'; import prepare = require('./lib/prepare'); import * as config from '../src/config'; import * as deviceState from '../src/device-state'; import Log from '../src/lib/supervisor-console'; -import { expect } from 'chai'; import balenaAPI = require('./lib/mocked-balena-api'); import { schema } from '../src/config/schema'; import ConfigJsonConfigBackend from '../src/config/configJson'; @@ -16,12 +16,11 @@ import { DeviceStatus } from '../src/types/state'; import * as CurrentState from '../src/device-state/current-state'; import * as ApiHelper from '../src/lib/api-helper'; import supervisorVersion = require('../src/lib/supervisor-version'); +import * as eventTracker from '../src/event-tracker'; import { TypedError } from 'typed-error'; import { DeviceNotFoundError } from '../src/lib/errors'; -import { eventTrackSpy } from './lib/mocked-event-tracker'; - let ApiBinder: typeof import('../src/api-binder'); class ExpectedError extends TypedError {} @@ -83,8 +82,10 @@ describe('ApiBinder', () => { // We do not support older OS versions anymore, so we only test this case describe('on an OS with deviceApiKey support', () => { const components: Dictionary = {}; + let eventTrackSpy: SinonSpy; before(async () => { + eventTrackSpy = spy(eventTracker, 'track'); await initModels(components, '/config-apibinder.json'); }); diff --git a/test/12-device-config.spec.ts b/test/12-device-config.spec.ts index dc6ba119..39120d16 100644 --- a/test/12-device-config.spec.ts +++ b/test/12-device-config.spec.ts @@ -1,8 +1,8 @@ import { stripIndent } from 'common-tags'; import { promises as fs } from 'fs'; import { SinonStub, stub, spy, SinonSpy } from 'sinon'; - import { expect } from 'chai'; + import * as deviceConfig from '../src/device-config'; import * as fsUtils from '../src/lib/fs-utils'; import * as logger from '../src/logger'; diff --git a/test/13-application-manager.spec.ts b/test/13-application-manager.spec.ts index 25002e93..49ae227d 100644 --- a/test/13-application-manager.spec.ts +++ b/test/13-application-manager.spec.ts @@ -1,6 +1,7 @@ import * as Bluebird from 'bluebird'; import * as _ from 'lodash'; import { stub } from 'sinon'; +import { expect } from 'chai'; import Network from '../src/compose/network'; @@ -10,7 +11,6 @@ import * as deviceState from '../src/device-state'; import * as dockerUtils from '../src/lib/docker-utils'; import * as images from '../src/compose/images'; -import * as chai from 'chai'; import prepare = require('./lib/prepare'); import * as db from '../src/db'; import * as dbFormat from '../src/device-state/db-format'; @@ -20,10 +20,6 @@ import { TargetApplication, TargetApplications } from '../src/types/state'; import * as applicationManager from '../src/compose/application-manager'; -// tslint:disable-next-line -chai.use(require('chai-events')); -const { expect } = chai; - let availableImages: any[] | null; let targetState: any[] | null; diff --git a/test/16-config-utils.spec.ts b/test/16-config-utils.spec.ts index 2cd711be..6bec1f51 100644 --- a/test/16-config-utils.spec.ts +++ b/test/16-config-utils.spec.ts @@ -1,7 +1,7 @@ import { stub } from 'sinon'; import * as _ from 'lodash'; - import { expect } from 'chai'; + import * as config from '../src/config'; import * as configUtils from '../src/config/utils'; import { ExtraUEnv } from '../src/config/backends/extra-uEnv'; diff --git a/test/20-compose-volume.spec.ts b/test/20-compose-volume.spec.ts index 7ccd374c..ead0953f 100644 --- a/test/20-compose-volume.spec.ts +++ b/test/20-compose-volume.spec.ts @@ -3,7 +3,6 @@ import { stub, SinonStub } from 'sinon'; import { docker } from '../src/lib/docker-utils'; import * as logger from '../src/logger'; - import Volume from '../src/compose/volume'; import logTypes = require('../src/lib/log-types'); diff --git a/test/22-local-mode.spec.ts b/test/22-local-mode.spec.ts index a30475f0..bb95e79a 100644 --- a/test/22-local-mode.spec.ts +++ b/test/22-local-mode.spec.ts @@ -1,4 +1,3 @@ -import * as assert from 'assert'; import { expect } from 'chai'; import * as Docker from 'dockerode'; import * as sinon from 'sinon'; @@ -400,11 +399,10 @@ describe.skip('LocalModeManager', () => { }); try { - await localMode.retrieveLatestSnapshot(); - assert.fail('Parsing error was expected'); + const result = await localMode.retrieveLatestSnapshot(); + expect(result).to.not.exist; } catch (e) { - console.log(e.message); - expect(e.message).to.contain('bad json'); + expect(e.message).to.match(/Cannot parse snapshot data.*"bad json"/); } }); @@ -417,11 +415,12 @@ describe.skip('LocalModeManager', () => { }); try { - await localMode.retrieveLatestSnapshot(); - assert.fail('Parsing error was expected'); + const result = await localMode.retrieveLatestSnapshot(); + expect(result).to.not.exist; } catch (e) { - console.log(e.message); - expect(e.message).to.contain('bad timestamp'); + expect(e.message).to.match( + /Cannot parse snapshot data.*"bad timestamp"/, + ); } }); }); diff --git a/test/23-contracts.spec.ts b/test/23-contracts.spec.ts index 78e613c8..c3ef7e19 100644 --- a/test/23-contracts.spec.ts +++ b/test/23-contracts.spec.ts @@ -1,4 +1,4 @@ -import { assert, expect } from 'chai'; +import { expect } from 'chai'; import { SinonStub, stub } from 'sinon'; import * as semver from 'semver'; @@ -95,8 +95,8 @@ describe('Container contracts', () => { expect(await osRelease.getOSSemver(constants.hostOSVersionPath)).to.equal( '2.0.6', ); - assert(semver.gt(supervisorVersionGreater, supervisorVersion)); - assert(semver.lt(supervisorVersionLesser, supervisorVersion)); + expect(semver.gt(supervisorVersionGreater, supervisorVersion)).to.be.true; + expect(semver.lt(supervisorVersionLesser, supervisorVersion)).to.be.true; }); it('Should correctly run containers with no requirements', async () => { diff --git a/test/25-journald.spec.ts b/test/25-journald.spec.ts index 0b24cbda..79a00ddd 100644 --- a/test/25-journald.spec.ts +++ b/test/25-journald.spec.ts @@ -1,7 +1,8 @@ import { SinonStub, stub } from 'sinon'; +import { expect } from 'chai'; + import constants = require('../src/lib/constants'); import { spawnJournalctl } from '../src/lib/journald'; -import { expect } from 'chai'; describe('journald', () => { let spawn: SinonStub; diff --git a/test/27-extlinux-config.spec.ts b/test/27-extlinux-config.spec.ts index 690ba03d..d0d602f8 100644 --- a/test/27-extlinux-config.spec.ts +++ b/test/27-extlinux-config.spec.ts @@ -1,8 +1,8 @@ import { promises as fs } from 'fs'; import { stripIndent } from 'common-tags'; import { SinonStub, stub } from 'sinon'; - import { expect } from 'chai'; + import * as fsUtils from '../src/lib/fs-utils'; import { Extlinux } from '../src/config/backends/extlinux'; diff --git a/test/28-db-format.spec.ts b/test/28-db-format.spec.ts index fb900a74..1bd2285d 100644 --- a/test/28-db-format.spec.ts +++ b/test/28-db-format.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; -import prepare = require('./lib/prepare'); import * as _ from 'lodash'; +import prepare = require('./lib/prepare'); import * as config from '../src/config'; import * as dbFormat from '../src/device-state/db-format'; import * as targetStateCache from '../src/device-state/target-state-cache'; diff --git a/test/29-append-directive.spec.ts b/test/29-append-directive.spec.ts index 3439f3a8..2c53427d 100644 --- a/test/29-append-directive.spec.ts +++ b/test/29-append-directive.spec.ts @@ -1,5 +1,5 @@ -import { AppendDirective } from '../src/config/backends/extlinux-file'; import { expect } from 'chai'; +import { AppendDirective } from '../src/config/backends/extlinux-file'; describe('APPEND directive', () => { const supportedConfigValues = ['isolcpus']; diff --git a/test/30-fdt-directive.spec.ts b/test/30-fdt-directive.spec.ts index fb5b6d79..ac130056 100644 --- a/test/30-fdt-directive.spec.ts +++ b/test/30-fdt-directive.spec.ts @@ -1,5 +1,5 @@ -import { FDTDirective } from '../src/config/backends/extlinux-file'; import { expect } from 'chai'; +import { FDTDirective } from '../src/config/backends/extlinux-file'; describe('FDT directive', () => { const directive = new FDTDirective(); diff --git a/test/32-compose-app-manager.spec.ts b/test/32-compose-app-manager.spec.ts index db63a3cc..69687ea6 100644 --- a/test/32-compose-app-manager.spec.ts +++ b/test/32-compose-app-manager.spec.ts @@ -1,7 +1,4 @@ -import * as chai from 'chai'; import { expect } from 'chai'; -import * as chaiThings from 'chai-things'; -import * as chaiLike from 'chai-like'; import _ = require('lodash'); import * as dbFormat from '../src/device-state/db-format'; @@ -18,9 +15,6 @@ import Network from '../src/compose/network'; import prepare = require('./lib/prepare'); import { intialiseContractRequirements } from '../src/lib/contracts'; -chai.use(chaiLike); -chai.use(chaiThings); - describe('compose/application-manager', () => { before(async () => { await config.initialized; diff --git a/test/33-extra-uenv-config.spec.ts b/test/33-extra-uenv-config.spec.ts index 5313c78a..8dea5428 100644 --- a/test/33-extra-uenv-config.spec.ts +++ b/test/33-extra-uenv-config.spec.ts @@ -1,8 +1,8 @@ import { promises as fs } from 'fs'; import { stripIndent } from 'common-tags'; import { SinonStub, spy, stub } from 'sinon'; - import { expect } from 'chai'; + import * as fsUtils from '../src/lib/fs-utils'; import Log from '../src/lib/supervisor-console'; import { ExtraUEnv } from '../src/config/backends/extra-uEnv'; diff --git a/test/37-odmdata-config.spec.ts b/test/37-odmdata-config.spec.ts index 49971170..efa1e32c 100644 --- a/test/37-odmdata-config.spec.ts +++ b/test/37-odmdata-config.spec.ts @@ -1,9 +1,8 @@ import { SinonStub, stub } from 'sinon'; import { promises as fs } from 'fs'; - import { resolve } from 'path'; - import { expect } from 'chai'; + import Log from '../src/lib/supervisor-console'; import { Odmdata } from '../src/config/backends/odmdata'; diff --git a/test/39-compose-commit.spec.ts b/test/39-compose-commit.spec.ts index b8a64424..3f6f7f0f 100644 --- a/test/39-compose-commit.spec.ts +++ b/test/39-compose-commit.spec.ts @@ -1,4 +1,5 @@ import { expect } from 'chai'; + import * as commitStore from '../src/compose/commit'; import * as db from '../src/db'; diff --git a/test/39-compose-images.spec.ts b/test/39-compose-images.spec.ts index 7feb9dce..c0ecba37 100644 --- a/test/39-compose-images.spec.ts +++ b/test/39-compose-images.spec.ts @@ -1,7 +1,7 @@ import * as _ from 'lodash'; +import { expect } from 'chai'; import { docker } from '../src/lib/docker-utils'; -import { expect } from 'chai'; import * as Images from '../src/compose/images'; import * as mockedDockerode from './lib/mocked-dockerode'; import * as mockedDatabase from './lib/mocked-database'; @@ -82,7 +82,7 @@ describe('compose/images', () => { await Images.remove(IMAGE_TO_REMOVE); // Check that docker does not have this image await expect(docker.getImage(IMAGE_TO_REMOVE.name).inspect()).to - .eventually.be.empty; + .eventually.be.undefined; // Check that the database longer has this image await expect(db.models('image').select().where(IMAGE_TO_REMOVE)).to .eventually.be.empty; @@ -118,7 +118,7 @@ describe('compose/images', () => { await Images.remove(IMAGE_TO_REMOVE); // Check that docker does not have this image await expect(docker.getImage(IMAGE_TO_REMOVE.name).inspect()).to - .eventually.be.empty; + .eventually.be.undefined; // Check that the database no longer has this image await expect(db.models('image').select().where(IMAGE_TO_REMOVE)).to .eventually.be.empty; diff --git a/test/40-target-state.spec.ts b/test/40-target-state.spec.ts index 367bd8ec..469e9e4c 100644 --- a/test/40-target-state.spec.ts +++ b/test/40-target-state.spec.ts @@ -1,10 +1,9 @@ import { SinonStub, stub, spy, SinonSpy } from 'sinon'; import { Promise } from 'bluebird'; - import * as _ from 'lodash'; import rewire = require('rewire'); - import { expect } from 'chai'; + import { sleep } from './lib/helpers'; import * as TargetState from '../src/device-state/target-state'; import Log from '../src/lib/supervisor-console'; diff --git a/test/44-volume-manager.spec.ts b/test/44-volume-manager.spec.ts index c62cf6d1..83938aa4 100644 --- a/test/44-volume-manager.spec.ts +++ b/test/44-volume-manager.spec.ts @@ -1,11 +1,11 @@ import { expect } from 'chai'; import { stub, SinonStub } from 'sinon'; +import { VolumeInspectInfo } from 'dockerode'; import * as mockedDockerode from './lib/mocked-dockerode'; import * as volumeManager from '../src/compose/volume-manager'; import log from '../src/lib/supervisor-console'; import Volume from '../src/compose/volume'; -import { VolumeInspectInfo } from 'dockerode'; describe('Volume Manager', () => { let logDebug: SinonStub; diff --git a/test/config/fixtures.ts b/test/config/fixtures.ts new file mode 100644 index 00000000..67774d4d --- /dev/null +++ b/test/config/fixtures.ts @@ -0,0 +1,25 @@ +import * as chai from 'chai'; +import * as chaiAsPromised from 'chai-as-promised'; +import * as sinonChai from 'sinon-chai'; +import * as chaiThings from 'chai-things'; +import * as chaiLike from 'chai-like'; + +/** + * Mocha runs this EXACTLY ONCE before all tests to set up globals that + * are used among all test files, such as chai assertion plugins. See + * https://mochajs.org/#test-fixture-decision-tree-wizard-thing + * + * IMPORTANT: The functionality in this global fixture hook should not break any + * suite run in isolation, and it should be required by ALL test suites. + * If unsure whether to add to global fixtures, refer to the chart above. + * Also, avoid setting global mutable variables here. + */ +export const mochaGlobalSetup = function () { + console.log('Setting up global fixtures for tests...'); + + /* Setup chai assertion plugins */ + chai.use(chaiAsPromised); + chai.use(sinonChai); + chai.use(chaiLike); + chai.use(chaiThings); +}; diff --git a/test/fast-mocha.opts b/test/fast-mocha.opts deleted file mode 100644 index ca137126..00000000 --- a/test/fast-mocha.opts +++ /dev/null @@ -1,5 +0,0 @@ ---exit ---require ts-node/register/transpile-only ---timeout 30000 ---bail -test/**/*.spec.ts diff --git a/test/lib/chai-config.ts b/test/lib/chai-config.ts deleted file mode 100644 index f6f3b4c6..00000000 --- a/test/lib/chai-config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import * as chai from 'chai'; -import chaiAsPromised = require('chai-as-promised'); -import sinonChai = require('sinon-chai'); - -chai.use(chaiAsPromised as any); -chai.use(sinonChai); - -export = chai; diff --git a/test/lib/mocked-event-tracker.ts b/test/lib/mocked-event-tracker.ts deleted file mode 100644 index a8800654..00000000 --- a/test/lib/mocked-event-tracker.ts +++ /dev/null @@ -1,4 +0,0 @@ -import * as eventTracker from '../../src/event-tracker'; -import { spy } from 'sinon'; - -export const eventTrackSpy = spy(eventTracker, 'track'); diff --git a/test/mocha.opts b/test/mocha.opts deleted file mode 100644 index f383576e..00000000 --- a/test/mocha.opts +++ /dev/null @@ -1,3 +0,0 @@ ---exit ---timeout 30000 -build/test/**/*.spec.js