2017-04-23 20:08:52 +00:00
|
|
|
import { HrtMeasurement } from 'early';
|
2017-04-23 12:35:16 +00:00
|
|
|
export declare type TTestStatus = 'success' | 'error' | 'pending' | 'errorAfterSuccess';
|
2017-04-23 09:10:13 +00:00
|
|
|
export interface ITestFunction {
|
|
|
|
(): Promise<any>;
|
|
|
|
}
|
|
|
|
export declare class TapTest {
|
|
|
|
description: string;
|
2017-04-23 20:08:52 +00:00
|
|
|
parallel: boolean;
|
|
|
|
hrtMeasurement: HrtMeasurement;
|
2017-04-23 09:10:13 +00:00
|
|
|
testFunction: ITestFunction;
|
|
|
|
status: TTestStatus;
|
|
|
|
/**
|
|
|
|
* constructor
|
|
|
|
*/
|
|
|
|
constructor(optionsArg: {
|
|
|
|
description: string;
|
|
|
|
testFunction: ITestFunction;
|
|
|
|
parallel: boolean;
|
|
|
|
});
|
|
|
|
/**
|
|
|
|
* run the test
|
|
|
|
*/
|
|
|
|
run(testKeyArg: number): Promise<void>;
|
|
|
|
}
|
|
|
|
export declare class Tap {
|
|
|
|
private _tests;
|
2017-04-23 12:35:16 +00:00
|
|
|
/**
|
|
|
|
* Normal test function, will run one by one
|
|
|
|
* @param testDescription - A description of what the test does
|
|
|
|
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
|
|
|
*/
|
2017-04-23 09:10:13 +00:00
|
|
|
test(testDescription: string, testFunction: ITestFunction): Promise<void>;
|
2017-04-23 12:35:16 +00:00
|
|
|
/**
|
|
|
|
* A parallel test that will not be waited for before the next starts.
|
|
|
|
* @param testDescription - A description of what the test does
|
|
|
|
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
|
|
|
*/
|
2017-04-23 09:10:13 +00:00
|
|
|
testParallel(testDescription: string, testFunction: ITestFunction): void;
|
2017-04-23 12:35:16 +00:00
|
|
|
/**
|
|
|
|
* tests leakage
|
|
|
|
* @param testDescription - A description of what the test does
|
|
|
|
* @param testFunction - A Function that returns a Promise and resolves or rejects
|
|
|
|
*/
|
|
|
|
testLeakage(testDescription: string, testFunction: ITestFunction): void;
|
2017-04-23 09:10:13 +00:00
|
|
|
/**
|
|
|
|
* starts the test evaluation
|
|
|
|
*/
|
|
|
|
start(): Promise<void>;
|
|
|
|
/**
|
|
|
|
* handle errors
|
|
|
|
*/
|
|
|
|
threw(err: any): void;
|
|
|
|
}
|
|
|
|
export declare let tap: Tap;
|