UNPKG

2.48 kBTypeScriptView Raw
1import { CancellablePromise } from '@theintern/common';
2import Deferred from './Deferred';
3import { Executor } from './executors/Executor';
4import Test from './Test';
5import { InternError } from './types';
6import { Remote } from './executors/Node';
7export default class Suite implements SuiteProperties {
8 after: SuiteLifecycleFunction | undefined;
9 afterEach: TestLifecycleFunction | undefined;
10 async: ((timeout?: number) => Deferred<void>) | undefined;
11 before: SuiteLifecycleFunction | undefined;
12 beforeEach: TestLifecycleFunction | undefined;
13 error: InternError | undefined;
14 parent: Suite | undefined;
15 publishAfterSetup: boolean;
16 skipped: string | undefined;
17 tests: (Suite | Test)[];
18 timeElapsed: number | undefined;
19 private _bail;
20 private _executor;
21 private _name;
22 private _grep;
23 private _remote;
24 private _sessionId;
25 private _timeout;
26 constructor(options: SuiteOptions | RootSuiteOptions);
27 bail: boolean;
28 executor: Executor;
29 grep: RegExp;
30 name: string | undefined;
31 readonly id: string;
32 readonly parentId: string | undefined;
33 remote: Remote;
34 sessionId: string;
35 readonly numTests: number;
36 readonly numPassedTests: number;
37 readonly numFailedTests: number;
38 readonly numSkippedTests: number;
39 readonly hasParent: boolean;
40 timeout: number;
41 add(suiteOrTest: Suite | Test): void;
42 private _applyGrepToSuiteOrTest;
43 private _applyGrepToChildren;
44 run(): CancellablePromise<void>;
45 skip(message?: string): void;
46 toJSON(): object;
47}
48export declare function isSuite(value: any): value is Suite;
49export interface SuiteLifecycleFunction {
50 (this: Suite, suite: Suite): void | PromiseLike<any>;
51}
52export interface TestLifecycleFunction {
53 (this: Suite, test: Test, suite: Suite): void | PromiseLike<any>;
54}
55export interface SuiteProperties {
56 after: SuiteLifecycleFunction | undefined;
57 afterEach: TestLifecycleFunction | undefined;
58 bail: boolean | undefined;
59 before: SuiteLifecycleFunction | undefined;
60 beforeEach: TestLifecycleFunction | undefined;
61 grep: RegExp;
62 name: string | undefined;
63 publishAfterSetup: boolean;
64 timeout: number;
65}
66export declare type SuiteOptions = Partial<SuiteProperties> & {
67 name: string;
68 parent: Suite;
69 tests?: (Suite | Test)[];
70};
71export declare type RootSuiteOptions = Partial<SuiteProperties> & {
72 executor: Executor;
73 tests?: (Suite | Test)[];
74};
75
\No newline at end of file