1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import type { CoverageMapData } from 'istanbul-lib-coverage';
|
9 | export declare type ValidTestReturnValues = void | undefined;
|
10 | declare type TestReturnValuePromise = Promise<unknown>;
|
11 | declare type TestReturnValueGenerator = Generator<void, unknown, void>;
|
12 | export declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise;
|
13 | export declare type TestContext = Record<string, unknown>;
|
14 | export declare type DoneFn = (reason?: string | Error) => void;
|
15 | export declare type DoneTakingTestFn = (this: TestContext | undefined, done: DoneFn) => ValidTestReturnValues;
|
16 | export declare type PromiseReturningTestFn = (this: TestContext | undefined) => TestReturnValue;
|
17 | export declare type GeneratorReturningTestFn = (this: TestContext | undefined) => TestReturnValueGenerator;
|
18 | export declare type TestName = string;
|
19 | export declare type TestFn = PromiseReturningTestFn | GeneratorReturningTestFn | DoneTakingTestFn;
|
20 | export declare type ConcurrentTestFn = () => TestReturnValuePromise;
|
21 | export declare type BlockFn = () => void;
|
22 | export declare type BlockName = string;
|
23 | export declare type HookFn = TestFn;
|
24 | export declare type Col = unknown;
|
25 | export declare type Row = Array<Col>;
|
26 | export declare type Table = Array<Row>;
|
27 | export declare type ArrayTable = Table | Row;
|
28 | export declare type TemplateTable = TemplateStringsArray;
|
29 | export declare type TemplateData = Array<unknown>;
|
30 | export declare type EachTable = ArrayTable | TemplateTable;
|
31 | export declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn;
|
32 | export declare type EachTestFn<EachCallback extends TestCallback> = (...args: Array<any>) => ReturnType<EachCallback>;
|
33 | declare type Jasmine = {
|
34 | _DEFAULT_TIMEOUT_INTERVAL?: number;
|
35 | addMatchers: (matchers: Record<string, unknown>) => void;
|
36 | };
|
37 | declare type Each<EachCallback extends TestCallback> = ((table: EachTable, ...taggedTemplateData: Array<unknown>) => (title: string, test: EachTestFn<EachCallback>, timeout?: number) => void) | (() => () => void);
|
38 | export interface HookBase {
|
39 | (fn: HookFn, timeout?: number): void;
|
40 | }
|
41 | export interface ItBase {
|
42 | (testName: TestName, fn: TestFn, timeout?: number): void;
|
43 | each: Each<TestFn>;
|
44 | }
|
45 | export interface It extends ItBase {
|
46 | only: ItBase;
|
47 | skip: ItBase;
|
48 | todo: (testName: TestName) => void;
|
49 | }
|
50 | export interface ItConcurrentBase {
|
51 | (testName: string, testFn: ConcurrentTestFn, timeout?: number): void;
|
52 | each: Each<ConcurrentTestFn>;
|
53 | }
|
54 | export interface ItConcurrentExtended extends ItConcurrentBase {
|
55 | only: ItConcurrentBase;
|
56 | skip: ItConcurrentBase;
|
57 | }
|
58 | export interface ItConcurrent extends It {
|
59 | concurrent: ItConcurrentExtended;
|
60 | }
|
61 | export interface DescribeBase {
|
62 | (blockName: BlockName, blockFn: BlockFn): void;
|
63 | each: Each<BlockFn>;
|
64 | }
|
65 | export interface Describe extends DescribeBase {
|
66 | only: DescribeBase;
|
67 | skip: DescribeBase;
|
68 | }
|
69 | export interface TestFrameworkGlobals {
|
70 | it: ItConcurrent;
|
71 | test: ItConcurrent;
|
72 | fit: ItBase & {
|
73 | concurrent?: ItConcurrentBase;
|
74 | };
|
75 | xit: ItBase;
|
76 | xtest: ItBase;
|
77 | describe: Describe;
|
78 | xdescribe: DescribeBase;
|
79 | fdescribe: DescribeBase;
|
80 | beforeAll: HookBase;
|
81 | beforeEach: HookBase;
|
82 | afterEach: HookBase;
|
83 | afterAll: HookBase;
|
84 | }
|
85 | export interface GlobalAdditions extends TestFrameworkGlobals {
|
86 | __coverage__: CoverageMapData;
|
87 | jasmine: Jasmine;
|
88 | fail: () => void;
|
89 | pending: () => void;
|
90 | spyOn: () => void;
|
91 | spyOnProperty: () => void;
|
92 | }
|
93 | export interface Global extends GlobalAdditions, Omit<NodeJS.Global, keyof GlobalAdditions> {
|
94 | [extras: string]: unknown;
|
95 | }
|
96 | export {};
|