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