@everyonesoftware/common 5.0.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/outputs/characterWriteStream-ogvZec-U.d.cts +798 -0
- package/outputs/characterWriteStream-ogvZec-U.d.ts +798 -0
- package/outputs/{chunk-AY3YWKOM.js → chunk-MMAX3IZF.js} +4911 -3470
- package/outputs/chunk-MMAX3IZF.js.map +1 -0
- package/outputs/chunk-VF6FBNAU.js +1062 -0
- package/outputs/chunk-VF6FBNAU.js.map +1 -0
- package/outputs/{sources.cjs → sourceIndex.cjs} +926 -560
- package/outputs/sourceIndex.cjs.map +1 -0
- package/outputs/{sources.d.cts → sourceIndex.d.cts} +457 -1160
- package/outputs/{sources.d.ts → sourceIndex.d.ts} +457 -1160
- package/outputs/sourceIndex.js +331 -0
- package/outputs/sourceIndex.js.map +1 -0
- package/outputs/testIndex.cjs +6522 -0
- package/outputs/testIndex.cjs.map +1 -0
- package/outputs/testIndex.d.cts +476 -0
- package/outputs/testIndex.d.ts +476 -0
- package/outputs/testIndex.js +26 -0
- package/outputs/testIndex.js.map +1 -0
- package/outputs/tests.cjs +13935 -12780
- package/outputs/tests.cjs.map +1 -1
- package/outputs/tests.js +2763 -3032
- package/outputs/tests.js.map +1 -1
- package/package.json +7 -7
- package/outputs/chunk-AY3YWKOM.js.map +0 -1
- package/outputs/sources.cjs.map +0 -1
- package/outputs/sources.js +0 -1370
- package/outputs/sources.js.map +0 -1
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import { f as JavascriptIterable, S as SyncResult, P as PromiseAsyncResult, k as Type, I as Iterable, A as AsyncResult, C as CharacterWriteStream } from './characterWriteStream-ogvZec-U.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A type that can be used to make assertions during a test.
|
|
5
|
+
*/
|
|
6
|
+
declare abstract class Test {
|
|
7
|
+
/**
|
|
8
|
+
* Fail the current test with the provided message.
|
|
9
|
+
* @param message The message that explains why this test failed.
|
|
10
|
+
*/
|
|
11
|
+
abstract fail(message: string): never;
|
|
12
|
+
/**
|
|
13
|
+
* Assert that the provided value is undefined;
|
|
14
|
+
* @param value The value to check.
|
|
15
|
+
*/
|
|
16
|
+
assertUndefined(value: unknown): asserts value is undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Assert that the provided value is undefined.
|
|
19
|
+
* @param test The current {@link Test}.
|
|
20
|
+
* @param value The value to check.
|
|
21
|
+
*/
|
|
22
|
+
static assertUndefined(test: Test, value: unknown): asserts value is undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Assert that the provided value is not undefined;
|
|
25
|
+
* @param value The value to check.
|
|
26
|
+
*/
|
|
27
|
+
assertNotUndefined<T>(value: T): asserts value is NonNullable<T>;
|
|
28
|
+
/**
|
|
29
|
+
* Assert that the provided value is not undefined.
|
|
30
|
+
* @param test The current {@link Test}.
|
|
31
|
+
* @param value The value to check.
|
|
32
|
+
*/
|
|
33
|
+
static assertNotUndefined<T>(test: Test, value: unknown): asserts value is NonNullable<T>;
|
|
34
|
+
/**
|
|
35
|
+
* Assert that the provided value is null.
|
|
36
|
+
* @param value The value to check.
|
|
37
|
+
*/
|
|
38
|
+
assertNull(value: unknown): asserts value is null;
|
|
39
|
+
/**
|
|
40
|
+
* Assert that the provided value is null.
|
|
41
|
+
* @param value The value to check.
|
|
42
|
+
*/
|
|
43
|
+
static assertNull(test: Test, value: unknown): asserts value is null;
|
|
44
|
+
/**
|
|
45
|
+
* Assert that the provided value is not null.
|
|
46
|
+
* @param value The value to check.
|
|
47
|
+
*/
|
|
48
|
+
assertNotNull<T>(value: T): asserts value is NonNullable<T>;
|
|
49
|
+
/**
|
|
50
|
+
* Assert that the provided value is not null.
|
|
51
|
+
* @param value The value to check.
|
|
52
|
+
*/
|
|
53
|
+
static assertNotNull<T>(test: Test, value: T): asserts value is NonNullable<T>;
|
|
54
|
+
/**
|
|
55
|
+
* Assert that the provided value is not undefined and not null.
|
|
56
|
+
* @param value The value to check.
|
|
57
|
+
*/
|
|
58
|
+
assertNotUndefinedAndNotNull<T>(value: T): asserts value is NonNullable<T>;
|
|
59
|
+
/**
|
|
60
|
+
* Assert that the provided value is not undefined and not null.
|
|
61
|
+
* @param value The value to check.
|
|
62
|
+
*/
|
|
63
|
+
static assertNotUndefinedAndNotNull<T>(test: Test, value: T): asserts value is NonNullable<T>;
|
|
64
|
+
/**
|
|
65
|
+
* Assert that the provided collection is not undefined, not null, and not empty.
|
|
66
|
+
* @param value The value to check.
|
|
67
|
+
*/
|
|
68
|
+
assertNotEmpty(value: JavascriptIterable<unknown>): void;
|
|
69
|
+
static assertNotEmpty(test: Test, value: JavascriptIterable<unknown>): void;
|
|
70
|
+
/**
|
|
71
|
+
* Assert that the provided values point to the same object.
|
|
72
|
+
* @param left The first value.
|
|
73
|
+
* @param right The second value.
|
|
74
|
+
*/
|
|
75
|
+
abstract assertSame<T>(left: T, right: T): void;
|
|
76
|
+
/**
|
|
77
|
+
* Assert that the provided values don't point to the same object.
|
|
78
|
+
* @param left The first value.
|
|
79
|
+
* @param right The second value.
|
|
80
|
+
*/
|
|
81
|
+
abstract assertNotSame<T>(left: T, right: T): void;
|
|
82
|
+
/**
|
|
83
|
+
* Assert that the provided values are equal.
|
|
84
|
+
* @param left The first value.
|
|
85
|
+
* @param right The second value.
|
|
86
|
+
* @param message A message that will be shown when the values are not equal.
|
|
87
|
+
*/
|
|
88
|
+
abstract assertEqual<T>(left: T, right: T, message?: string): void;
|
|
89
|
+
/**
|
|
90
|
+
* Assert that the provided values are not equal.
|
|
91
|
+
* @param left The first value.
|
|
92
|
+
* @param right The second value.
|
|
93
|
+
*/
|
|
94
|
+
abstract assertNotEqual<T>(left: T, right: T): void;
|
|
95
|
+
/**
|
|
96
|
+
* Assert that the provided value is false.
|
|
97
|
+
* @param value The value to check.
|
|
98
|
+
*/
|
|
99
|
+
assertFalse(value: boolean): asserts value is false;
|
|
100
|
+
static assertFalse(test: Test, value: boolean): asserts value is false;
|
|
101
|
+
/**
|
|
102
|
+
* Assert that the provided value is true.
|
|
103
|
+
* @param value The value to check.
|
|
104
|
+
*/
|
|
105
|
+
assertTrue(value: boolean): asserts value is true;
|
|
106
|
+
/**
|
|
107
|
+
* Assert that the provided value is true.
|
|
108
|
+
* @param value The value to check.
|
|
109
|
+
*/
|
|
110
|
+
static assertTrue(test: Test, value: boolean): asserts value is true;
|
|
111
|
+
/**
|
|
112
|
+
* Assert that the provided action throws the provided {@link Error} when it is run.
|
|
113
|
+
* @param action The action to run.
|
|
114
|
+
* @param expectedError The optional expected {@link Error} to compare against the thrown
|
|
115
|
+
* {@link Error}. If the expected {@link Error} is not provided, then any {@link Error} will
|
|
116
|
+
* satisfy this assertion.
|
|
117
|
+
*/
|
|
118
|
+
abstract assertThrows(action: SyncResult<unknown> | (() => void), expectedError?: Error): void;
|
|
119
|
+
/**
|
|
120
|
+
* Assert that the provided action throws the provided {@link Error} when it is run.
|
|
121
|
+
* @param action The action to run.
|
|
122
|
+
* @param expectedError The expected {@link Error}.
|
|
123
|
+
*/
|
|
124
|
+
abstract assertThrowsAsync(action: PromiseLike<unknown> | (() => PromiseLike<unknown>), expectedError: Error): PromiseAsyncResult<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Assert that the provided value is an instance of the provided {@link Type}.
|
|
127
|
+
* @param value The value to check.
|
|
128
|
+
* @param type The {@link Type} to check.
|
|
129
|
+
* @param expression The expression that produced the value.
|
|
130
|
+
* @param message An optional error message.
|
|
131
|
+
*/
|
|
132
|
+
assertInstanceOf<T>(value: unknown, type: Type<T>, typeCheck?: (value: unknown) => value is T): asserts value is T;
|
|
133
|
+
/**
|
|
134
|
+
* Assert that the provided value is an instance of the provided {@link Type}.
|
|
135
|
+
* @param value The value to check.
|
|
136
|
+
* @param type The {@link Type} to check.
|
|
137
|
+
* @param expression The expression that produced the value.
|
|
138
|
+
* @param message An optional error message.
|
|
139
|
+
*/
|
|
140
|
+
static assertInstanceOf<T>(test: Test, value: unknown, type: Type<T>, typeCheck?: (value: unknown) => value is T): asserts value is T;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* A {@link Test} type that uses the standard "assert" module to make assertions.
|
|
145
|
+
*/
|
|
146
|
+
declare class AssertTest implements Test {
|
|
147
|
+
private readonly name;
|
|
148
|
+
protected constructor(name: string);
|
|
149
|
+
/**
|
|
150
|
+
* Create a new {@link AssertTest} object.
|
|
151
|
+
*/
|
|
152
|
+
static create(name: string): AssertTest;
|
|
153
|
+
fail(message: string): never;
|
|
154
|
+
assertUndefined(value: unknown): asserts value is undefined;
|
|
155
|
+
assertNotUndefined<T>(value: T): asserts value is NonNullable<T>;
|
|
156
|
+
assertNull(value: unknown): asserts value is null;
|
|
157
|
+
assertNotNull<T>(value: T): asserts value is NonNullable<T>;
|
|
158
|
+
assertNotUndefinedAndNotNull<T>(value: T): asserts value is NonNullable<T>;
|
|
159
|
+
assertNotEmpty(value: JavascriptIterable<unknown>): void;
|
|
160
|
+
assertSame<T>(left: T, right: T): void;
|
|
161
|
+
assertNotSame<T>(left: T, right: T): void;
|
|
162
|
+
assertEqual<T>(left: T, right: T, message?: string): void;
|
|
163
|
+
assertNotEqual<T>(left: T, right: T): void;
|
|
164
|
+
assertFalse(value: boolean): void;
|
|
165
|
+
assertTrue(value: boolean): void;
|
|
166
|
+
assertThrows(action: SyncResult<unknown> | (() => void), expectedError?: Error): void;
|
|
167
|
+
assertThrowsAsync(action: Promise<unknown> | (() => Promise<unknown>), expectedError: Error): PromiseAsyncResult<void>;
|
|
168
|
+
assertInstanceOf<T>(value: unknown, type: Type<T>, typeCheck?: (value: unknown) => value is T): asserts value is T;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* A type that is used to mark that a test group or a test should be skipped.
|
|
173
|
+
*/
|
|
174
|
+
declare abstract class TestSkip {
|
|
175
|
+
protected constructor();
|
|
176
|
+
/**
|
|
177
|
+
* Create a new {@link TestSkip} with the provided properties.
|
|
178
|
+
* @param shouldSkip Whether the tests associated with the new {@link TestSkip}
|
|
179
|
+
* should be skipped.
|
|
180
|
+
* @param message The message that explains why the tests associated with this {@link TestSkip}
|
|
181
|
+
* should be skipped.
|
|
182
|
+
*/
|
|
183
|
+
static create(shouldSkip?: boolean, message?: string): TestSkip;
|
|
184
|
+
/**
|
|
185
|
+
* Get whether the tests associated with this {@link TestSkip} should be skipped.
|
|
186
|
+
*/
|
|
187
|
+
abstract getShouldSkip(): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Get the message that explains why the tests associated with this {@link TestSkip}
|
|
190
|
+
* should be skipped.
|
|
191
|
+
*/
|
|
192
|
+
abstract getMessage(): string;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* A type that can be used to run tests.
|
|
197
|
+
*/
|
|
198
|
+
declare abstract class TestRunner {
|
|
199
|
+
/**
|
|
200
|
+
* Get a {@link string} that concatenates the {@link string} representation of each
|
|
201
|
+
* of the provided values into an "and-list".
|
|
202
|
+
* @param values The values to concatenate.
|
|
203
|
+
*/
|
|
204
|
+
andList(values: unknown[] | Iterable<unknown>): string;
|
|
205
|
+
/**
|
|
206
|
+
* Get a {@link string} that concatenates the {@link string} representation of each
|
|
207
|
+
* of the provided values into an "and-list".
|
|
208
|
+
* @param values The values to concatenate.
|
|
209
|
+
*/
|
|
210
|
+
static andList(runner: TestRunner, values: unknown[] | Iterable<unknown>): string;
|
|
211
|
+
/**
|
|
212
|
+
* Get the {@link string} representation of the provided value.
|
|
213
|
+
* @param value The value to get the {@link string} representation of.
|
|
214
|
+
*/
|
|
215
|
+
toString(value: unknown): string;
|
|
216
|
+
/**
|
|
217
|
+
* Get the {@link string} representation of the provided value.
|
|
218
|
+
* @param value The value to get the {@link string} representation of.
|
|
219
|
+
*/
|
|
220
|
+
static toString(_runner: TestRunner, value: unknown): string;
|
|
221
|
+
skip(message?: string): TestSkip;
|
|
222
|
+
/**
|
|
223
|
+
* Create a {@link TestSkip} object that will prevent tests from being run.
|
|
224
|
+
* @param shouldSkip Whether these tests should be skipped.
|
|
225
|
+
* @param message The message that explains why the tests are being skipped.
|
|
226
|
+
*/
|
|
227
|
+
skip(shouldSkip: boolean, message?: string): TestSkip;
|
|
228
|
+
/**
|
|
229
|
+
* Create a {@link TestSkip} object that will prevent tests from being run.
|
|
230
|
+
* @param shouldSkip Whether these tests should be skipped.
|
|
231
|
+
* @param message The message that explains why the tests are being skipped.
|
|
232
|
+
*/
|
|
233
|
+
static skip(_runner: TestRunner, shouldSkip?: boolean, message?: string): TestSkip;
|
|
234
|
+
/**
|
|
235
|
+
* Create a test group that will test the provided file.
|
|
236
|
+
* @param fileName The name of the file that is being tested.
|
|
237
|
+
* @param testAction The action that will run the tests.
|
|
238
|
+
*/
|
|
239
|
+
abstract testFile(fileName: string, testAction: (() => void) | ((test: Test) => void)): void;
|
|
240
|
+
/**
|
|
241
|
+
* Create a test group that will test the provided file.
|
|
242
|
+
* @param fileName The name of the file that is being tested.
|
|
243
|
+
* @param skip A value that indicates whether these tests should be skipped.
|
|
244
|
+
* @param testAction The action that will run the tests.
|
|
245
|
+
*/
|
|
246
|
+
abstract testFile(fileName: string, skip: TestSkip | undefined, testAction: (() => void) | ((test: Test) => void)): void;
|
|
247
|
+
/**
|
|
248
|
+
* Create a test group that will test the provided type.
|
|
249
|
+
* @param type The {@link Type} or name of the type that is being tested.
|
|
250
|
+
* @param testAction The action that will run the tests.
|
|
251
|
+
*/
|
|
252
|
+
abstract testType(typeNameOrType: string | Type<unknown>, testAction: (() => void) | ((test: Test) => void)): void;
|
|
253
|
+
/**
|
|
254
|
+
* Create a test group that will test the provided type.
|
|
255
|
+
* @param type The {@link Type} or name of the type that is being tested.
|
|
256
|
+
* @param skip A value that indicates whether these tests should be skipped.
|
|
257
|
+
* @param testAction The action that will run the tests.
|
|
258
|
+
*/
|
|
259
|
+
abstract testType(typeNameOrType: string | Type<unknown>, skip: TestSkip | undefined, testAction: (() => void) | ((test: Test) => void)): void;
|
|
260
|
+
/**
|
|
261
|
+
* Create a test group that will test the provided function.
|
|
262
|
+
* @param functionSignature The signature of the function that is being tested.
|
|
263
|
+
* @param testAction The action that will run the tests.
|
|
264
|
+
*/
|
|
265
|
+
abstract testFunction(functionSignature: string, testAction: (() => void) | ((test: Test) => void)): void;
|
|
266
|
+
/**
|
|
267
|
+
* Create a test group that will test the provided function.
|
|
268
|
+
* @param functionSignature The signature of the function that is being tested.
|
|
269
|
+
* @param testAction The action that will run the tests.
|
|
270
|
+
*/
|
|
271
|
+
abstract testFunction(functionSignature: string, skip: TestSkip | undefined, testAction: (() => void) | ((test: Test) => void)): void;
|
|
272
|
+
/**
|
|
273
|
+
* Create and run a test group with the provided name.
|
|
274
|
+
* @param testGroupName The name of the test group to run.
|
|
275
|
+
* @param testAction The action that runs the test group.
|
|
276
|
+
*/
|
|
277
|
+
abstract testGroup(testGroupName: string, testAction: () => void): void;
|
|
278
|
+
/**
|
|
279
|
+
* Create and run a test group with the provided name.
|
|
280
|
+
* @param testGroupName The name of the test group to run.
|
|
281
|
+
* @param testAction The action that runs the test group.
|
|
282
|
+
*/
|
|
283
|
+
abstract testGroup(testGroupName: string, skip: TestSkip | undefined, testAction: () => void): void;
|
|
284
|
+
/**
|
|
285
|
+
* Create and run a test with the provided name.
|
|
286
|
+
* @param testName The name of the test to run.
|
|
287
|
+
* @param testAction The action that runs the test.
|
|
288
|
+
*/
|
|
289
|
+
abstract test(testName: string, testAction: (test: Test) => void): void;
|
|
290
|
+
/**
|
|
291
|
+
* Create and run a test with the provided name.
|
|
292
|
+
* @param testName The name of the test to run.
|
|
293
|
+
* @param testAction The action that runs the test.
|
|
294
|
+
*/
|
|
295
|
+
abstract test(testName: string, skip: TestSkip | undefined, testAction: (test: Test) => void): void;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
declare function test(runner: TestRunner): void;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* A type that is used to mark that a test group or a test should be skipped.
|
|
302
|
+
*/
|
|
303
|
+
declare class BasicTestSkip implements TestSkip {
|
|
304
|
+
private readonly shouldSkip;
|
|
305
|
+
private readonly message;
|
|
306
|
+
private constructor();
|
|
307
|
+
/**
|
|
308
|
+
* Create a new {@link TestSkip} with the provided properties.
|
|
309
|
+
* @param shouldSkip Whether the tests associated with the new {@link TestSkip}
|
|
310
|
+
* should be skipped.
|
|
311
|
+
* @param message The message that explains why the tests associated with this {@link TestSkip}
|
|
312
|
+
* should be skipped.
|
|
313
|
+
*/
|
|
314
|
+
static create(shouldSkip?: boolean, message?: string): BasicTestSkip;
|
|
315
|
+
getShouldSkip(): boolean;
|
|
316
|
+
getMessage(): string;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
type TestActionType = "file" | "type" | "function" | "group" | "test";
|
|
320
|
+
declare class TestAction {
|
|
321
|
+
private readonly parent;
|
|
322
|
+
private readonly name;
|
|
323
|
+
private readonly type;
|
|
324
|
+
private readonly skip;
|
|
325
|
+
private readonly action;
|
|
326
|
+
private constructor();
|
|
327
|
+
static create(parent: TestAction | undefined, name: string, type: TestActionType, skip: TestSkip | undefined, action: () => (void | Promise<void>)): TestAction;
|
|
328
|
+
getParent(): TestAction | undefined;
|
|
329
|
+
getName(): string;
|
|
330
|
+
getFullNameParts(): JavascriptIterable<string>;
|
|
331
|
+
getFullName(): string;
|
|
332
|
+
getType(): TestActionType;
|
|
333
|
+
getSkip(): TestSkip | undefined;
|
|
334
|
+
shouldSkip(): boolean;
|
|
335
|
+
getAction(): () => (void | Promise<void>);
|
|
336
|
+
runAsync(): void | Promise<void>;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
declare class FailedTest {
|
|
340
|
+
private readonly testAction;
|
|
341
|
+
private readonly error;
|
|
342
|
+
private constructor();
|
|
343
|
+
static create(testAction: TestAction, error: unknown): FailedTest;
|
|
344
|
+
getTestAction(): TestAction;
|
|
345
|
+
getError(): unknown;
|
|
346
|
+
getErrorMessage(): string;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
declare class SkippedTest {
|
|
350
|
+
private readonly skip;
|
|
351
|
+
private readonly testAction;
|
|
352
|
+
private constructor();
|
|
353
|
+
static create(skip: TestSkip, testAction: TestAction): SkippedTest;
|
|
354
|
+
getSkipMessage(): string;
|
|
355
|
+
getTestAction(): TestAction;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
type ConsoleTestRunnerStyle = TestActionType | "passed" | "skipped" | "failed";
|
|
359
|
+
declare abstract class ConsoleTestRunnerUI {
|
|
360
|
+
private writeStream?;
|
|
361
|
+
private readonly styles;
|
|
362
|
+
protected constructor();
|
|
363
|
+
static flat(): FlatConsoleTestRunnerUI;
|
|
364
|
+
static tree(): TreeConsoleTestRunnerUI;
|
|
365
|
+
setWriteStream(writeStream: CharacterWriteStream): this;
|
|
366
|
+
setStyle(style: ConsoleTestRunnerStyle, styleFunction: (text: string) => string): this;
|
|
367
|
+
setStyles(styles: Partial<Record<ConsoleTestRunnerStyle, (text: string) => string>>): this;
|
|
368
|
+
private applyStyle;
|
|
369
|
+
protected addIndentation(): void;
|
|
370
|
+
protected removeIndentation(): void;
|
|
371
|
+
protected indent(action: () => number | void | PromiseLike<number | void>): AsyncResult<number>;
|
|
372
|
+
protected writeString(text: string): AsyncResult<number>;
|
|
373
|
+
protected writeLine(text?: string): AsyncResult<number>;
|
|
374
|
+
protected writeTestActionName(testAction: TestAction): AsyncResult<number>;
|
|
375
|
+
protected writeFullTestActionName(testAction: TestAction): AsyncResult<number>;
|
|
376
|
+
beforeTestGroup(testGroup: TestAction): AsyncResult<void>;
|
|
377
|
+
afterTestGroup(testGroup: TestAction): AsyncResult<void>;
|
|
378
|
+
beforeTest(testAction: TestAction): AsyncResult<void>;
|
|
379
|
+
afterPassedTest(testAction: TestAction): AsyncResult<void>;
|
|
380
|
+
afterSkippedTest(testAction: TestAction, skip: TestSkip): AsyncResult<void>;
|
|
381
|
+
afterFailedTest(currentTestAction: TestAction, error: unknown): AsyncResult<void>;
|
|
382
|
+
writeSummary(passedTestCount: number, skippedTests: Iterable<SkippedTest>, failedTests: Iterable<FailedTest>): AsyncResult<void>;
|
|
383
|
+
}
|
|
384
|
+
declare class FlatConsoleTestRunnerUI extends ConsoleTestRunnerUI {
|
|
385
|
+
protected constructor();
|
|
386
|
+
static create(): FlatConsoleTestRunnerUI;
|
|
387
|
+
beforeTest(testAction: TestAction): AsyncResult<void>;
|
|
388
|
+
}
|
|
389
|
+
declare class TreeConsoleTestRunnerUI extends ConsoleTestRunnerUI {
|
|
390
|
+
private testActions;
|
|
391
|
+
private testActionWrittenDepth;
|
|
392
|
+
protected constructor();
|
|
393
|
+
static create(): TreeConsoleTestRunnerUI;
|
|
394
|
+
beforeTestGroup(testGroup: TestAction): AsyncResult<void>;
|
|
395
|
+
afterTestGroup(testGroup: TestAction): AsyncResult<void>;
|
|
396
|
+
beforeTest(testAction: TestAction): AsyncResult<void>;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
type ConsoleTestFunction = (runner: ConsoleTestRunner) => (void | Promise<void>);
|
|
400
|
+
type ConsoleTestFunctionContainer = {
|
|
401
|
+
test: ConsoleTestFunction;
|
|
402
|
+
};
|
|
403
|
+
declare class ConsoleTestRunner implements TestRunner {
|
|
404
|
+
private writeStream;
|
|
405
|
+
private readonly testActions;
|
|
406
|
+
private testActionInsertIndex;
|
|
407
|
+
private currentTestAction;
|
|
408
|
+
private currentTest;
|
|
409
|
+
private passedTestCount;
|
|
410
|
+
private readonly skippedTests;
|
|
411
|
+
private readonly testFailures;
|
|
412
|
+
private readonly ui;
|
|
413
|
+
constructor(ui?: ConsoleTestRunnerUI);
|
|
414
|
+
static create(ui?: ConsoleTestRunnerUI): ConsoleTestRunner;
|
|
415
|
+
static run(testFunction: ConsoleTestFunction | ConsoleTestFunctionContainer): Promise<void>;
|
|
416
|
+
static run(testFunctions: JavascriptIterable<ConsoleTestFunction | ConsoleTestFunctionContainer>): Promise<void>;
|
|
417
|
+
setWriteStream(writeStream: CharacterWriteStream): this;
|
|
418
|
+
setStyle(style: ConsoleTestRunnerStyle, styleFunction: (text: string) => string): this;
|
|
419
|
+
setStyles(styles: Partial<Record<ConsoleTestRunnerStyle, (text: string) => string>>): this;
|
|
420
|
+
/**
|
|
421
|
+
* Get the number of {@link TestAction}s that have yet to be executed.
|
|
422
|
+
*/
|
|
423
|
+
getTestActionCount(): number;
|
|
424
|
+
/**
|
|
425
|
+
* Get the index in the {@link TestAction} list that new {@link TestAction}s will be
|
|
426
|
+
* inserted at.
|
|
427
|
+
*/
|
|
428
|
+
getTestActionInsertIndex(): number;
|
|
429
|
+
private resetTestActionInsertIndex;
|
|
430
|
+
private insertTestAction;
|
|
431
|
+
/**
|
|
432
|
+
* Get the number of tests that have been skipped.
|
|
433
|
+
*/
|
|
434
|
+
getSkippedTestCount(): number;
|
|
435
|
+
getSkippedTests(): Iterable<SkippedTest>;
|
|
436
|
+
/**
|
|
437
|
+
* Get the number of tests that have passed.
|
|
438
|
+
*/
|
|
439
|
+
getPassedTestCount(): number;
|
|
440
|
+
getFailedTestCount(): number;
|
|
441
|
+
getFailedTests(): Iterable<FailedTest>;
|
|
442
|
+
/**
|
|
443
|
+
* Get the {@link TestAction} that is currently executing or undefined if no {@link TestAction}
|
|
444
|
+
* is executing.
|
|
445
|
+
*/
|
|
446
|
+
getCurrentTestAction(): TestAction | undefined;
|
|
447
|
+
getCurrentTest(): Test | undefined;
|
|
448
|
+
private assertNoCurrentTest;
|
|
449
|
+
beforeTestGroup(testAction: TestAction): AsyncResult<void>;
|
|
450
|
+
afterTestGroup(testAction: TestAction): AsyncResult<void>;
|
|
451
|
+
beforeTest(testAction: TestAction): AsyncResult<void>;
|
|
452
|
+
afterPassedTest(testAction: TestAction): AsyncResult<void>;
|
|
453
|
+
afterSkippedTest(testAction: TestAction, skip: TestSkip): AsyncResult<void>;
|
|
454
|
+
afterFailedTest(testAction: TestAction, error: unknown): AsyncResult<void>;
|
|
455
|
+
andList(values: unknown[] | Iterable<unknown>): string;
|
|
456
|
+
toString(value: unknown): string;
|
|
457
|
+
skip(message?: string): TestSkip;
|
|
458
|
+
skip(shouldSkip: boolean, message?: string): TestSkip;
|
|
459
|
+
testFile(fileName: string, testAction: (() => void) | ((test: Test) => void)): void;
|
|
460
|
+
testFile(fileName: string, skip: TestSkip | undefined, testAction: (() => void) | ((test: Test) => void)): void;
|
|
461
|
+
testType(typeNameOrType: string | Type<unknown>, testAction: (() => void) | ((test: Test) => void)): void;
|
|
462
|
+
testType(typeNameOrType: string | Type<unknown>, skip: TestSkip | undefined, testAction: (() => void) | ((test: Test) => void)): void;
|
|
463
|
+
testFunction(functionSignature: string, testAction: (() => void) | ((test: Test) => void)): void;
|
|
464
|
+
testFunction(functionSignature: string, skip: TestSkip | undefined, testAction: (() => void) | ((test: Test) => void)): void;
|
|
465
|
+
testGroup(testGroupName: string, testAction: () => (void | Promise<void>)): void;
|
|
466
|
+
testGroup(testGroupName: string, skip: TestSkip | undefined, testAction: () => (void | Promise<void>)): void;
|
|
467
|
+
test(testName: string, testAction: (test: Test) => (void | Promise<void>)): void;
|
|
468
|
+
test(testName: string, skip: TestSkip | undefined, testAction: (test: Test) => (void | Promise<void>)): void;
|
|
469
|
+
private innerTestGroup;
|
|
470
|
+
private innerTest;
|
|
471
|
+
private testGroupOrTest;
|
|
472
|
+
runAsync(): Promise<void>;
|
|
473
|
+
printSummary(): AsyncResult<void>;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export { AssertTest, BasicTestSkip, type ConsoleTestFunction, type ConsoleTestFunctionContainer, ConsoleTestRunner, FailedTest, SkippedTest, Test, TestAction, type TestActionType, TestRunner, TestSkip, test };
|