From 1c11efd3de42f76a5fc8241ad5be193ff5f46736 Mon Sep 17 00:00:00 2001 From: Doug Parker Date: Sat, 2 May 2020 22:33:17 -0700 Subject: [PATCH] Convert tests to run with Karma. Refs #1. Previously we used Jasmine, however this runs within Node. Using Karma for debug tests and Jasmine for normal tests, means that one set runs in a browser and the other set runs in Node, which creates some discrepancies. By using Karma, all tests are consistently running in a browser. Running in a browsers is preferable to Node, because the browser is closer to the real runtime where bxpb will be used. --- packages/bxpb-runtime/package-lock.json | 34 +++++++++++++------ packages/bxpb-runtime/package.json | 4 +-- .../bxpb-runtime/spec/support/jasmine.json | 8 ----- 3 files changed, 26 insertions(+), 20 deletions(-) delete mode 100644 packages/bxpb-runtime/spec/support/jasmine.json diff --git a/packages/bxpb-runtime/package-lock.json b/packages/bxpb-runtime/package-lock.json index 2e9881f..0b8f404 100644 --- a/packages/bxpb-runtime/package-lock.json +++ b/packages/bxpb-runtime/package-lock.json @@ -1648,6 +1648,12 @@ "integrity": "sha512-ORrEy+SNVqUhrCaal4hA4fBzhggQQ+BaLntyPOdoEiwlKZW9BZiJXjg3RMiruE4tPEI3pyVPpySHQF/dKWperg==", "dev": true }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, "istanbul-lib-coverage": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", @@ -1735,16 +1741,6 @@ "istanbul-lib-report": "^3.0.0" } }, - "jasmine": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.5.0.tgz", - "integrity": "sha512-DYypSryORqzsGoMazemIHUfMkXM7I7easFaxAvNM3Mr6Xz3Fy36TupTrAOxZWN8MVKEU5xECv22J4tUQf3uBzQ==", - "dev": true, - "requires": { - "glob": "^7.1.4", - "jasmine-core": "~3.5.0" - } - }, "jasmine-core": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.5.0.tgz", @@ -1819,6 +1815,15 @@ "yargs": "^15.3.1" } }, + "karma-chrome-launcher": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.0.tgz", + "integrity": "sha512-3dPs/n7vgz1rxxtynpzZTvb9y/GIaW8xjAwcIGttLbycqoFtI7yo1NGnQi6oFTherRE+GIhCAHZC4vEqWGhNvg==", + "dev": true, + "requires": { + "which": "^1.2.1" + } + }, "karma-jasmine": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-3.1.1.tgz", @@ -2949,6 +2954,15 @@ "defaults": "^1.0.3" } }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", diff --git a/packages/bxpb-runtime/package.json b/packages/bxpb-runtime/package.json index 0284565..1b67a98 100644 --- a/packages/bxpb-runtime/package.json +++ b/packages/bxpb-runtime/package.json @@ -21,7 +21,7 @@ }, "scripts": { "build": "tsc", - "test": "tsc -p tsconfig.spec.json && jasmine", + "test": "karma start --browsers ChromeHeadless --singleRun", "test:debug": "karma start" }, "bugs": { @@ -31,8 +31,8 @@ "@types/chrome": "^0.0.106", "@types/google-protobuf": "^3.7.2", "@types/jasmine": "^3.5.10", - "jasmine": "^3.5.0", "karma": "^5.0.4", + "karma-chrome-launcher": "^3.1.0", "karma-jasmine": "^3.1.1", "karma-jasmine-html-reporter": "^1.5.3", "karma-typescript": "^5.0.2", diff --git a/packages/bxpb-runtime/spec/support/jasmine.json b/packages/bxpb-runtime/spec/support/jasmine.json deleted file mode 100644 index d42b362..0000000 --- a/packages/bxpb-runtime/spec/support/jasmine.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "spec_dir": "test-out/", - "spec_files": [ - "**/*[sS]pec.js" - ], - "stopSpecOnExpectationFailure": false, - "random": true -}