1 | interface IAssertionResult<T> {
|
2 | pass: boolean;
|
3 | actual: unknown;
|
4 | expected: T;
|
5 | description: string;
|
6 | operator: string;
|
7 | at?: string;
|
8 | }
|
9 |
|
10 | interface ComparatorAssertionFunction {
|
11 | <T>(actual: unknown, expected: T, description?: string): IAssertionResult<T>;
|
12 | }
|
13 |
|
14 | interface BooleanAssertionFunction {
|
15 | (actual: unknown, description?: string): IAssertionResult<boolean>;
|
16 | }
|
17 |
|
18 | type ErrorAssertionFunction =
|
19 | | ((
|
20 | fn: Function,
|
21 | expected: RegExp | Function,
|
22 | description?: string
|
23 | ) => IAssertionResult<RegExp | Function>)
|
24 | | ((fn: Function, description?: string) => IAssertionResult<undefined>);
|
25 |
|
26 | interface MessageAssertionFunction {
|
27 | (message?: string): IAssertionResult<string>;
|
28 | }
|
29 |
|
30 | interface IAssert$1 {
|
31 | equal: ComparatorAssertionFunction;
|
32 |
|
33 | equals: ComparatorAssertionFunction;
|
34 |
|
35 | eq: ComparatorAssertionFunction;
|
36 |
|
37 | deepEqual: ComparatorAssertionFunction;
|
38 |
|
39 | notEqual: ComparatorAssertionFunction;
|
40 |
|
41 | notEquals: ComparatorAssertionFunction;
|
42 |
|
43 | notEq: ComparatorAssertionFunction;
|
44 |
|
45 | notDeepEqual: ComparatorAssertionFunction;
|
46 |
|
47 | is: ComparatorAssertionFunction;
|
48 |
|
49 | same: ComparatorAssertionFunction;
|
50 |
|
51 | isNot: ComparatorAssertionFunction;
|
52 |
|
53 | notSame: ComparatorAssertionFunction;
|
54 |
|
55 | ok: BooleanAssertionFunction;
|
56 |
|
57 | truthy: BooleanAssertionFunction;
|
58 |
|
59 | notOk: BooleanAssertionFunction;
|
60 |
|
61 | falsy: BooleanAssertionFunction;
|
62 |
|
63 | fail: MessageAssertionFunction;
|
64 |
|
65 | throws: ErrorAssertionFunction;
|
66 | }
|
67 |
|
68 | declare const Assert: IAssert$1;
|
69 |
|
70 | interface INewTestMessageInput {
|
71 | description: string;
|
72 | skip: boolean;
|
73 | }
|
74 |
|
75 | interface ITestEndMessageInput {
|
76 | description: string;
|
77 | executionTime: number;
|
78 | }
|
79 |
|
80 | interface IMessage<T> {
|
81 | type: string;
|
82 | data: T;
|
83 | }
|
84 |
|
85 | interface INewTestMessage extends IMessage<INewTestMessageInput> {
|
86 | type: 'TEST_START';
|
87 | }
|
88 |
|
89 | interface IAssertionMessage extends IMessage<IAssertionResult<unknown>> {
|
90 | type: 'ASSERTION';
|
91 | }
|
92 |
|
93 | interface ITestEndMessage extends IMessage<ITestEndMessageInput> {
|
94 | type: 'TEST_END';
|
95 | }
|
96 |
|
97 | interface IErrorMessage extends IMessage<{ error: unknown }> {
|
98 | type: 'ERROR';
|
99 | }
|
100 |
|
101 | type Message =
|
102 | | IAssertionMessage
|
103 | | IErrorMessage
|
104 | | ITestEndMessage
|
105 | | INewTestMessage;
|
106 |
|
107 | interface IReporter {
|
108 | (messageStream: AsyncIterable<Message>): Promise<void>;
|
109 | }
|
110 |
|
111 | interface ILogOptions {
|
112 | log?: (message: any) => void;
|
113 | serialize?: (value: any) => string;
|
114 | }
|
115 |
|
116 | declare function createJSONReporter(opts?: ILogOptions): IReporter;
|
117 |
|
118 | declare function createTAPReporter(opts?: ILogOptions): IReporter;
|
119 |
|
120 | interface IReportOptions {
|
121 | reporter: IReporter;
|
122 | }
|
123 |
|
124 | interface IHarnessOptions {
|
125 | onlyMode?: boolean;
|
126 | }
|
127 |
|
128 | interface ITester {
|
129 | test: ITestFunction;
|
130 | skip: ITestFunction;
|
131 | only: ITestFunction;
|
132 | }
|
133 |
|
134 | interface IAssert extends IAssert$1, ITester {}
|
135 |
|
136 | interface ISpecFunction {
|
137 | (assert: IAssert): any;
|
138 | }
|
139 |
|
140 | interface ITestOptions {
|
141 | skip?: boolean;
|
142 | }
|
143 |
|
144 | interface ITestFunction {
|
145 | (
|
146 | description: string,
|
147 | spec: ISpecFunction,
|
148 | opts?: ITestOptions
|
149 | ): Promise<any> & AsyncIterable<Message>;
|
150 | }
|
151 |
|
152 | interface ITestHarness extends ITester {
|
153 | report(opts: IReportOptions): ReturnType<IReporter>;
|
154 | }
|
155 |
|
156 | declare function hold(): void;
|
157 | declare function report(opts: IReportOptions): ReturnType<IReporter>;
|
158 | declare function createHarness(opts: IHarnessOptions): ITestHarness;
|
159 | declare const test: ITestFunction;
|
160 | declare const only: ITestFunction;
|
161 | declare const skip: ITestFunction;
|
162 |
|
163 | export { Assert, IAssert, IHarnessOptions, ILogOptions, IReportOptions, ISpecFunction, ITestFunction, ITestHarness, ITestOptions, ITester, createHarness, createJSONReporter, createTAPReporter, hold, only, report, skip, test };
|