intern
Version:
Intern. A next-generation code testing stack for JavaScript.
62 lines (61 loc) • 2.03 kB
TypeScript
import { CancellablePromise } from '@theintern/common';
import { Executor } from './executors/Executor';
import Deferred from './Deferred';
import { InternError } from './types';
import { Remote } from './executors/Node';
import Suite from './Suite';
export default class Test implements TestProperties {
name: string;
parent: Suite;
skipped: string | undefined;
test: TestFunction;
error: InternError | undefined;
suiteError: InternError | undefined;
protected _hasPassed: boolean;
protected _isAsync: boolean;
protected _timeout: number | undefined;
protected _runTask: CancellablePromise<any> | undefined;
protected _timeElapsed: number | undefined;
protected _timer: any | undefined;
protected _usesRemote: boolean;
constructor(options: TestOptions & {
timeElapsed?: number;
hasPassed?: boolean;
});
get executor(): Executor;
get hasPassed(): boolean;
get id(): string;
get isAsync(): boolean;
get parentId(): string;
get remote(): Remote;
get sessionId(): string;
get timeElapsed(): number | undefined;
get timeout(): number;
set timeout(value: number);
async(timeout?: number, numCallsUntilResolution?: number): Deferred<any>;
restartTimeout(timeout?: number): void;
run(): CancellablePromise<void>;
skip(message?: string): void;
toJSON(): {
[key: string]: any;
};
}
export declare function isTest(value: any): value is Test;
export declare function isTestOptions(value: any): value is TestOptions;
export interface TestFunction {
(this: Test, test: Test): void | PromiseLike<any>;
}
export declare function isTestFunction(value: any): value is TestFunction;
export interface TestProperties {
hasPassed: boolean;
name: string;
parent: Suite;
skipped: string | undefined;
test: TestFunction;
timeout: number;
}
export declare type TestOptions = Partial<TestProperties> & {
name: string;
test: TestFunction;
};
export declare const SKIP: any;