Run only web implementation in Karma

This commit is contained in:
dapplion 2020-11-20 19:08:53 +00:00
parent 4424bed87d
commit 70ccbfbe5b
3 changed files with 33 additions and 26 deletions

View File

@ -1,26 +1,25 @@
// eslint-disable-next-line @typescript-eslint/no-require-imports
const webpackConfig = require("./webpack.config");
module.exports = function(config) {
config.set({
module.exports = function (config) {
config.set({
basePath: "",
frameworks: ["mocha", "chai"],
files: ["test/unit/*.ts"],
exclude: [],
preprocessors: {
"test/unit/run-web-implementation.test.ts": ["webpack"],
},
webpack: {
mode: "production",
node: webpackConfig.node,
module: webpackConfig.module,
resolve: webpackConfig.resolve,
},
reporters: ["spec"],
basePath: "",
frameworks: ["mocha", "chai"],
files: ["test/unit/*.ts"],
exclude: [],
preprocessors: {
"test/**/*.ts": ["webpack"]
},
webpack: {
mode: "production",
node: webpackConfig.node,
module: webpackConfig.module,
resolve: webpackConfig.resolve
},
reporters: ["spec"],
browsers: ["ChromeHeadless"],
browsers: ["ChromeHeadless"],
singleRun: true
});
};
singleRun: true,
});
};

View File

@ -4,6 +4,7 @@ import {runPublicKeyTests} from "./publicKey.test";
import {runIndexTests} from "./index.test";
import {forEachImplementation} from "../switch";
// Import test's bls lib lazily to prevent breaking test with Karma
forEachImplementation(["blst", "herumi"], (bls) => {
runPrivateKeyTests(bls);
runPublicKeyTests(bls);

View File

@ -1,12 +1,19 @@
import herumi from "../../src/herumi";
import {runPrivateKeyTests} from "./privateKey.test";
import {runPublicKeyTests} from "./publicKey.test";
// import {runKeypairTests} from "./keypair.test";
import {runIndexTests} from "./index.test";
import {forEachImplementation} from "../switch";
forEachImplementation(["herumi"], (bls) => {
runPrivateKeyTests(bls);
runPublicKeyTests(bls);
// This file is intended to be compiled and run by Karma
// Do not import the node.bindings or it will break with:
// Error: BLST bindings loader should only run in a NodeJS context: process.platform
describe("herumi", () => {
before(async () => {
await herumi.initBLS();
});
runPrivateKeyTests(herumi);
runPublicKeyTests(herumi);
// runKeypairTests(bls);
runIndexTests(bls);
runIndexTests(herumi);
});