@selfage/test_runner
Version:
Let each test file be executable on its own.
41 lines (40 loc) • 1.31 kB
TypeScript
import { ParseOptions } from "commander";
import "source-map-support/register";
export interface TestCase {
name: string;
execute: (environment?: Environment) => void | Promise<void>;
setUp?: (environment?: Environment) => void | Promise<void>;
tearDown?: (environment?: Environment) => void | Promise<void>;
}
export interface Environment {
setUp?: () => void | Promise<void>;
tearDown?: () => void | Promise<void>;
}
export interface TestSet {
name: string;
cases: Array<TestCase>;
environment?: Environment;
}
export interface TestCaseResult {
name: string;
success: boolean;
}
export interface TestSetResult {
name: string;
cases: Array<TestCaseResult>;
}
export declare class TestRunner {
private setName;
private caseName;
private exitFn;
private testResults;
private prevRunPromise;
constructor(setName: string | undefined, caseName: string | undefined, exitFn: () => void);
static create(argv: Array<string>, parseOptions: ParseOptions, exitFn?: () => void): TestRunner;
private summarizeAndExit;
run(testSet: TestSet): void;
private static runAfterPrevRun;
private static runTestCase;
private static runTestSet;
}
export declare let TEST_RUNNER: TestRunner;