implement test suites
This commit is contained in:
parent
f11a194d10
commit
98ab998a1e
@ -1132,7 +1132,7 @@ export class BridgeIDBIndex implements IDBIndex {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("opening cursor on", this);
|
BridgeIDBFactory.enableTracing && console.log("opening cursor on", this);
|
||||||
|
|
||||||
this._confirmActiveTransaction();
|
this._confirmActiveTransaction();
|
||||||
|
|
||||||
|
@ -797,9 +797,17 @@ testCli
|
|||||||
.maybeArgument("pattern", clk.STRING, {
|
.maybeArgument("pattern", clk.STRING, {
|
||||||
help: "Glob pattern to select which tests to run",
|
help: "Glob pattern to select which tests to run",
|
||||||
})
|
})
|
||||||
|
.maybeOption("suites", ["--suites"], clk.STRING, {
|
||||||
|
help: "Only run selected suites (string-separated list)"
|
||||||
|
})
|
||||||
|
.flag("dryRun", ["--dry"], {
|
||||||
|
help: "Only print tests that will be selected to run."
|
||||||
|
})
|
||||||
.action(async (args) => {
|
.action(async (args) => {
|
||||||
await runTests({
|
await runTests({
|
||||||
include_pattern: args.runIntegrationtests.pattern,
|
includePattern: args.runIntegrationtests.pattern,
|
||||||
|
suiteSpec: args.runIntegrationtests.suites,
|
||||||
|
dryRun: args.runIntegrationtests.dryRun,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1408,7 +1408,7 @@ export class MerchantService implements MerchantServiceInterface {
|
|||||||
console.log("adding instance");
|
console.log("adding instance");
|
||||||
const url = `http://localhost:${this.merchantConfig.httpPort}/private/instances`;
|
const url = `http://localhost:${this.merchantConfig.httpPort}/private/instances`;
|
||||||
await axios.post(url, {
|
await axios.post(url, {
|
||||||
auth_token: instanceConfig.authToken,
|
auth: { method: "external" },
|
||||||
payto_uris: instanceConfig.paytoUris,
|
payto_uris: instanceConfig.paytoUris,
|
||||||
id: instanceConfig.id,
|
id: instanceConfig.id,
|
||||||
name: instanceConfig.name,
|
name: instanceConfig.name,
|
||||||
|
@ -228,3 +228,5 @@ export async function runMerchantExchangeConfusionTest(t: GlobalTestState) {
|
|||||||
|
|
||||||
t.assertTrue(confirmPayRes.type === ConfirmPayResultType.Done);
|
t.assertTrue(confirmPayRes.type === ConfirmPayResultType.Done);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runMerchantExchangeConfusionTest.suites = ["merchant"];
|
||||||
|
@ -70,6 +70,7 @@ import CancellationToken from "cancellationtoken";
|
|||||||
interface TestMainFunction {
|
interface TestMainFunction {
|
||||||
(t: GlobalTestState): Promise<void>;
|
(t: GlobalTestState): Promise<void>;
|
||||||
timeoutMs?: number;
|
timeoutMs?: number;
|
||||||
|
suites?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const allTests: TestMainFunction[] = [
|
const allTests: TestMainFunction[] = [
|
||||||
@ -108,7 +109,9 @@ const allTests: TestMainFunction[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export interface TestRunSpec {
|
export interface TestRunSpec {
|
||||||
include_pattern?: string;
|
includePattern?: string;
|
||||||
|
suiteSpec?: string;
|
||||||
|
dryRun?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TestInfo {
|
export interface TestInfo {
|
||||||
@ -171,9 +174,28 @@ export async function runTests(spec: TestRunSpec) {
|
|||||||
//process.on("unhandledRejection", handleSignal);
|
//process.on("unhandledRejection", handleSignal);
|
||||||
//process.on("uncaughtException", handleSignal);
|
//process.on("uncaughtException", handleSignal);
|
||||||
|
|
||||||
|
let suites: Set<string> | undefined;
|
||||||
|
|
||||||
|
if (spec.suiteSpec) {
|
||||||
|
suites = new Set(spec.suiteSpec.split(",").map((x) => x.trim()));
|
||||||
|
}
|
||||||
|
|
||||||
for (const [n, testCase] of allTests.entries()) {
|
for (const [n, testCase] of allTests.entries()) {
|
||||||
const testName = getTestName(testCase);
|
const testName = getTestName(testCase);
|
||||||
if (spec.include_pattern && !M(testName, spec.include_pattern)) {
|
if (spec.includePattern && !M(testName, spec.includePattern)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (suites) {
|
||||||
|
const ts = new Set(testCase.suites ?? []);
|
||||||
|
const intersection = new Set([...suites].filter((x) => ts.has(x)));
|
||||||
|
if (intersection.size === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spec.dryRun) {
|
||||||
|
console.log(`dry run: would run test ${testName}`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user