1 |
|
2 |
|
3 |
|
4 | import { Test } from '../Test';
|
5 | import { ICallback, IResolver, IGroupReport, ITestOptions, IOptions } from '../Contracts';
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | export declare class Group<T extends any[], H extends any[]> {
|
12 | title: string;
|
13 | private _resolveTestFn;
|
14 | private _resolveHookFn;
|
15 | private _options;
|
16 | private _hooks;
|
17 | |
18 |
|
19 |
|
20 |
|
21 | private _timeout;
|
22 | |
23 |
|
24 |
|
25 | private _error;
|
26 | |
27 |
|
28 |
|
29 | private _completed;
|
30 | |
31 |
|
32 |
|
33 |
|
34 |
|
35 | private _tests;
|
36 | |
37 |
|
38 |
|
39 |
|
40 | private _hasFailingTests;
|
41 | |
42 |
|
43 |
|
44 |
|
45 | private _hasCherryPickedTest;
|
46 | constructor(title: string, _resolveTestFn: IResolver<T>, _resolveHookFn: IResolver<H>, _options: IOptions);
|
47 | /**
|
48 | * Returns a boolean telling if group or any of the tests inside
|
49 | * the group has errors.
|
50 | */
|
51 | get hasErrors(): boolean;
|
52 | /**
|
53 | * Filter tests if grep value is defined
|
54 | */
|
55 | private _filterTests;
|
56 | /**
|
57 | * Run a hook and if it raises error, then we will
|
58 | * set the completed flag to true, along with the
|
59 | * error.
|
60 | */
|
61 | private _runHook;
|
62 | /**
|
63 | * Runs a single test along side with it's hooks.
|
64 | */
|
65 | private _runTest;
|
66 | /**
|
67 | * Runs all the tests one by one and also executes
|
68 | * the beforeEach and afterEach hooks
|
69 | */
|
70 | private _runTests;
|
71 | /**
|
72 | * Returns the JSON report for the group. The output of this
|
73 | * method is emitted as an event.
|
74 | */
|
75 | toJSON(): IGroupReport;
|
76 | /**
|
77 | * Define timeout for all the tests inside the group. Still
|
78 | * each test can override it's own timeout.
|
79 | */
|
80 | timeout(duration: number): this;
|
81 | /**
|
82 | * Create a new test as part of this group.
|
83 | */
|
84 | test(title: string, callback: ICallback<T>, testOptions?: Partial<ITestOptions>): Test<T>;
|
85 | /**
|
86 | * Add before hook to be executed before the group starts
|
87 | * executing tests.
|
88 | */
|
89 | before(cb: ICallback<H>): this;
|
90 | /**
|
91 | * Add after hook to be executed after the group has executed
|
92 | * all the tests.
|
93 | */
|
94 | after(cb: ICallback<H>): this;
|
95 | /**
|
96 | * Add before each hook to be execute before each test
|
97 | */
|
98 | beforeEach(cb: ICallback<H>): this;
|
99 | /**
|
100 | * Add after each hook to be execute before each test
|
101 | */
|
102 | afterEach(cb: ICallback<H>): this;
|
103 | /**
|
104 | * Run the group with it's hooks and all tests. Shouldn't be called
|
105 | * by the end user and Japa itself will call this method
|
106 | */
|
107 | run(): Promise<void>;
|
108 | }
|