japa
Version:
Lean test runner for Node.js
90 lines (89 loc) • 2.2 kB
TypeScript
/**
* @module Core
*/
export declare enum IEvents {
TESTSTARTED = "test:started",
TESTCOMPLETED = "test:completed",
GROUPSTARTED = "group:started",
GROUPCOMPLETED = "group:completed",
STARTED = "started",
COMPLETED = "completed"
}
export declare type IOptions = {
bail: boolean;
timeout: number;
grep?: RegExp;
};
export declare type ITestOptions = {
timeout: number;
regression: boolean;
only?: boolean;
skip?: boolean;
skipInCI?: boolean;
runInCI?: boolean;
};
export declare enum IGroupStatus {
FAILED = "failed",
PASSED = "passed",
PENDING = "pending"
}
export declare enum ITestStatus {
FAILED = "failed",
PASSED = "passed",
SKIPPED = "skipped",
TODO = "todo",
PENDING = "pending"
}
export declare type ITestReport = {
title: string;
status: ITestStatus;
regression: boolean;
regressionMessage: string;
duration: number;
error: Error | null;
};
export declare type IGroupReport = {
title: string;
status: IGroupStatus;
error: Error | null;
};
export declare type IReport = {
regressionCount: number;
passedCount: number;
skippedCount: number;
failedCount: number;
total: number;
todoCount: number;
groups: {
title: string;
failedTests: {
title: string;
error: Error;
}[];
failedHooks: {
title: string;
error: Error;
}[];
}[];
duration: number;
};
export declare type IConfigureOptions = {
bail: boolean;
timeout: number;
files: string[] | string;
grep: string | RegExp;
experimentalEsmSupport: boolean;
before: ((runner: any, emitter: any) => Promise<void>)[];
after: ((runner: any, emitter: any) => Promise<void>)[];
reporterFn: (emitter: any) => void;
filter: (file: string) => void;
};
/**
* Test callback function. Here `T` is the arguments resolved by
* @IResolver
*/
export declare type ICallback<T extends any[]> = (...args: T) => Promise<void> | void;
/**
* The resolver to return arguments for the tests and hooks
*/
export declare type IResolver<T> = (done: Function, postRun?: Function) => T;