UNPKG

2.03 kBTypeScriptView Raw
1import { CancellablePromise } from '@theintern/common';
2import { Executor } from './executors/Executor';
3import Deferred from './Deferred';
4import { InternError } from './types';
5import { Remote } from './executors/Node';
6import Suite from './Suite';
7export default class Test implements TestProperties {
8 name: string;
9 parent: Suite;
10 skipped: string | undefined;
11 test: TestFunction;
12 error: InternError | undefined;
13 suiteError: InternError | undefined;
14 protected _hasPassed: boolean;
15 protected _isAsync: boolean;
16 protected _timeout: number | undefined;
17 protected _runTask: CancellablePromise<any> | undefined;
18 protected _timeElapsed: number | undefined;
19 protected _timer: any | undefined;
20 protected _usesRemote: boolean;
21 constructor(options: TestOptions & {
22 timeElapsed?: number;
23 hasPassed?: boolean;
24 });
25 get executor(): Executor;
26 get hasPassed(): boolean;
27 get id(): string;
28 get isAsync(): boolean;
29 get parentId(): string;
30 get remote(): Remote;
31 get sessionId(): string;
32 get timeElapsed(): number | undefined;
33 get timeout(): number;
34 set timeout(value: number);
35 async(timeout?: number, numCallsUntilResolution?: number): Deferred<any>;
36 restartTimeout(timeout?: number): void;
37 run(): CancellablePromise<void>;
38 skip(message?: string): void;
39 toJSON(): {
40 [key: string]: any;
41 };
42}
43export declare function isTest(value: any): value is Test;
44export declare function isTestOptions(value: any): value is TestOptions;
45export interface TestFunction {
46 (this: Test, test: Test): void | PromiseLike<any>;
47}
48export declare function isTestFunction(value: any): value is TestFunction;
49export interface TestProperties {
50 hasPassed: boolean;
51 name: string;
52 parent: Suite;
53 skipped: string | undefined;
54 test: TestFunction;
55 timeout: number;
56}
57export declare type TestOptions = Partial<TestProperties> & {
58 name: string;
59 test: TestFunction;
60};
61export declare const SKIP: any;