intern
Version:
Intern. A next-generation code testing stack for JavaScript.
60 lines (59 loc) • 1.93 kB
TypeScript
import Task from '@dojo/core/async/Task';
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;
protected _hasPassed: boolean;
protected _isAsync: boolean;
protected _timeout: number | undefined;
protected _runTask: Task<any> | undefined;
protected _timeElapsed: number | undefined;
protected _timer: any | undefined;
protected _usesRemote: boolean;
constructor(options: TestOptions & {
timeElapsed?: number;
hasPassed?: boolean;
});
readonly executor: Executor;
readonly hasPassed: boolean;
readonly id: string;
readonly isAsync: boolean;
readonly parentId: string;
readonly remote: Remote;
readonly sessionId: string;
readonly timeElapsed: number | undefined;
timeout: number;
async(timeout?: number, numCallsUntilResolution?: number): Deferred<any>;
restartTimeout(timeout?: number): void;
run(): Task<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;