UNPKG

2.83 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 get bail(): boolean;
28 set bail(value: boolean);
29 get executor(): Executor;
30 set executor(value: Executor);
31 get grep(): RegExp;
32 set grep(value: RegExp);
33 get name(): string | undefined;
34 set name(value: string | undefined);
35 get id(): string;
36 get parentId(): string | undefined;
37 get remote(): Remote;
38 set remote(value: Remote);
39 get sessionId(): string;
40 set sessionId(value: string);
41 get numTests(): number;
42 get numPassedTests(): number;
43 get numFailedTests(): number;
44 get numSkippedTests(): number;
45 get hasParent(): boolean;
46 get timeout(): number;
47 set timeout(value: number);
48 add(suiteOrTest: Suite | Test): void;
49 private _applyGrepToSuiteOrTest;
50 private _applyGrepToChildren;
51 run(): CancellablePromise<void>;
52 skip(message?: string): void;
53 toJSON(): object;
54}
55export declare function isSuite(value: any): value is Suite;
56export interface SuiteLifecycleFunction {
57 (this: Suite, suite: Suite): void | PromiseLike<any>;
58}
59export interface TestLifecycleFunction {
60 (this: Suite, test: Test, suite: Suite): void | PromiseLike<any>;
61}
62export interface SuiteProperties {
63 after: SuiteLifecycleFunction | undefined;
64 afterEach: TestLifecycleFunction | undefined;
65 bail: boolean | undefined;
66 before: SuiteLifecycleFunction | undefined;
67 beforeEach: TestLifecycleFunction | undefined;
68 grep: RegExp;
69 name: string | undefined;
70 publishAfterSetup: boolean;
71 timeout: number;
72}
73export declare type SuiteOptions = Partial<SuiteProperties> & {
74 name: string;
75 parent: Suite;
76 tests?: (Suite | Test)[];
77};
78export declare type RootSuiteOptions = Partial<SuiteProperties> & {
79 executor: Executor;
80 tests?: (Suite | Test)[];
81};
82export declare type LifecycleMethod = keyof Pick<Suite, 'before' | 'after' | 'beforeEach' | 'afterEach'>;
83
\No newline at end of file