@vitest/expect 3.0.6 → 3.0.8

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/dist/chai.d.cts CHANGED
@@ -1,1968 +1,2125 @@
1
- // Type definitions for chai 4.3
2
- // Project: http://chaijs.com/
3
- // Definitions by: Bart van der Schoor <https://github.com/Bartvds>
4
- // Andrew Brown <https://github.com/AGBrown>
5
- // Olivier Chevet <https://github.com/olivr70>
6
- // Matt Wistrand <https://github.com/mwistrand>
7
- // Shaun Luttin <https://github.com/shaunluttin>
8
- // Satana Charuwichitratana <https://github.com/micksatana>
9
- // Erik Schierboom <https://github.com/ErikSchierboom>
10
- // Bogdan Paranytsia <https://github.com/bparan>
11
- // CXuesong <https://github.com/CXuesong>
12
- // Joey Kilpatrick <https://github.com/joeykilpatrick>
13
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
14
- // TypeScript Version: 3.0
15
-
16
- declare namespace Chai {
17
- type Message = string | (() => string);
18
- type ObjectProperty = string | symbol | number;
19
-
20
- interface PathInfo {
21
- parent: object;
22
- name: string;
23
- value?: any;
24
- exists: boolean;
1
+ // import deepEqual = require("deep-eql");
2
+
3
+ // declare global {
4
+ declare namespace Chai {
5
+ type Message = string | (() => string);
6
+ type ObjectProperty = string | symbol | number;
7
+
8
+ interface PathInfo {
9
+ parent: object;
10
+ name: string;
11
+ value?: any;
12
+ exists: boolean;
13
+ }
14
+
15
+ interface Constructor<T> {
16
+ new(...args: any[]): T;
17
+ }
18
+
19
+ interface ErrorConstructor {
20
+ new(...args: any[]): Error;
21
+ }
22
+
23
+ interface ChaiUtils {
24
+ addChainableMethod(
25
+ // object to define the method on, e.g. chai.Assertion.prototype
26
+ ctx: object,
27
+ // method name
28
+ name: string,
29
+ // method itself; any arguments
30
+ method: (...args: any[]) => void,
31
+ // called when property is accessed
32
+ chainingBehavior?: () => void,
33
+ ): void;
34
+ overwriteChainableMethod(
35
+ ctx: object,
36
+ name: string,
37
+ method: (...args: any[]) => void,
38
+ chainingBehavior?: () => void,
39
+ ): void;
40
+ addLengthGuard(
41
+ fn: Function,
42
+ assertionName: string,
43
+ isChainable: boolean,
44
+ ): void;
45
+ addMethod(ctx: object, name: string, method: Function): void;
46
+ addProperty(ctx: object, name: string, getter: () => any): void;
47
+ overwriteMethod(ctx: object, name: string, method: Function): void;
48
+ overwriteProperty(ctx: object, name: string, getter: (this: AssertionStatic, _super: any) => any): void;
49
+ compareByInspect(a: object, b: object): -1 | 1;
50
+ expectTypes(obj: object, types: string[]): void;
51
+ flag(obj: object, key: string, value?: any): any;
52
+ getActual(obj: object, args: AssertionArgs): any;
53
+ getProperties(obj: object): string[];
54
+ getEnumerableProperties(obj: object): string[];
55
+ getOwnEnumerablePropertySymbols(obj: object): symbol[];
56
+ getOwnEnumerableProperties(obj: object): Array<string | symbol>;
57
+ getMessage(errorLike: Error | string): string;
58
+ getMessage(obj: any, args: AssertionArgs): string;
59
+ inspect(obj: any, showHidden?: boolean, depth?: number, colors?: boolean): string;
60
+ isProxyEnabled(): boolean;
61
+ objDisplay(obj: object): void;
62
+ proxify(obj: object, nonChainableMethodName: string): object;
63
+ test(obj: object, args: AssertionArgs): boolean;
64
+ transferFlags(assertion: Assertion, obj: object, includeAll?: boolean): void;
65
+ compatibleInstance(thrown: Error, errorLike: Error | ErrorConstructor): boolean;
66
+ compatibleConstructor(thrown: Error, errorLike: Error | ErrorConstructor): boolean;
67
+ compatibleMessage(thrown: Error, errMatcher: string | RegExp): boolean;
68
+ getConstructorName(constructorFn: Function): string;
69
+ getFuncName(constructorFn: Function): string | null;
70
+
71
+ // Reexports from pathval:
72
+ hasProperty(obj: object | undefined | null, name: ObjectProperty): boolean;
73
+ getPathInfo(obj: object, path: string): PathInfo;
74
+ getPathValue(obj: object, path: string): object | undefined;
75
+
76
+ // eql: typeof deepEqual;
77
+ }
78
+
79
+ type ChaiPlugin = (chai: ChaiStatic, utils: ChaiUtils) => void;
80
+
81
+ interface ChaiStatic {
82
+ expect: ExpectStatic;
83
+ should(): Should;
84
+ /**
85
+ * Provides a way to extend the internals of Chai
86
+ */
87
+ use(fn: ChaiPlugin): ChaiStatic;
88
+ util: ChaiUtils;
89
+ assert: AssertStatic;
90
+ config: Config;
91
+ Assertion: AssertionStatic;
92
+ AssertionError: typeof AssertionError;
93
+ version: string;
94
+ }
95
+
96
+ export interface ExpectStatic {
97
+ (val: any, message?: string): Assertion;
98
+ fail(message?: string): never;
99
+ fail(actual: any, expected: any, message?: string, operator?: Operator): never;
100
+ }
101
+
102
+ export interface AssertStatic extends Assert {
103
+ }
104
+
105
+ // chai.Assertion.prototype.assert arguments
106
+ type AssertionArgs = [
107
+ any, // expression to be tested
108
+ Message, // message or function that returns message to display if expression fails
109
+ Message, // negatedMessage or function that returns negatedMessage to display if expression fails
110
+ any?, // expected value
111
+ any?, // actual value
112
+ boolean?, // showDiff, when set to `true`, assert will display a diff in addition to the message if expression fails
113
+ ];
114
+
115
+ export interface AssertionPrototype {
116
+ assert(...args: AssertionArgs): void;
117
+ _obj: any;
118
+ }
119
+
120
+ export interface AssertionStatic extends AssertionPrototype {
121
+ prototype: AssertionPrototype;
122
+
123
+ new(target: any, message?: string, ssfi?: Function, lockSsfi?: boolean): Assertion;
124
+
125
+ // Deprecated properties:
126
+ includeStack: boolean;
127
+ showDiff: boolean;
128
+
129
+ // Partials of functions on ChaiUtils:
130
+ addProperty(name: string, getter: (this: AssertionStatic) => any): void;
131
+ addMethod(name: string, method: (this: AssertionStatic, ...args: any[]) => any): void;
132
+ addChainableMethod(
133
+ name: string,
134
+ method: (this: AssertionStatic, ...args: any[]) => void,
135
+ chainingBehavior?: () => void,
136
+ ): void;
137
+ overwriteProperty(name: string, getter: (this: AssertionStatic, _super: any) => any): void;
138
+ overwriteMethod(name: string, method: (this: AssertionStatic, ...args: any[]) => any): void;
139
+ overwriteChainableMethod(
140
+ name: string,
141
+ method: (this: AssertionStatic, ...args: any[]) => void,
142
+ chainingBehavior?: () => void,
143
+ ): void;
144
+ }
145
+
146
+ export type Operator = string; // "==" | "===" | ">" | ">=" | "<" | "<=" | "!=" | "!==";
147
+
148
+ export type OperatorComparable = boolean | null | number | string | undefined | Date;
149
+
150
+ interface ShouldAssertion {
151
+ equal(value1: any, value2: any, message?: string): void;
152
+ Throw: ShouldThrow;
153
+ throw: ShouldThrow;
154
+ exist(value: any, message?: string): void;
155
+ }
156
+
157
+ interface Should extends ShouldAssertion {
158
+ not: ShouldAssertion;
159
+ fail(message?: string): never;
160
+ fail(actual: any, expected: any, message?: string, operator?: Operator): never;
161
+ }
162
+
163
+ interface ShouldThrow {
164
+ (actual: Function, expected?: string | RegExp, message?: string): void;
165
+ (actual: Function, constructor: Error | Function, expected?: string | RegExp, message?: string): void;
166
+ }
167
+
168
+ interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
169
+ not: Assertion;
170
+ deep: Deep;
171
+ ordered: Ordered;
172
+ nested: Nested;
173
+ own: Own;
174
+ any: KeyFilter;
175
+ all: KeyFilter;
176
+ a: Assertion;
177
+ an: Assertion;
178
+ include: Include;
179
+ includes: Include;
180
+ contain: Include;
181
+ contains: Include;
182
+ ok: Assertion;
183
+ true: Assertion;
184
+ false: Assertion;
185
+ null: Assertion;
186
+ undefined: Assertion;
187
+ NaN: Assertion;
188
+ exist: Assertion;
189
+ empty: Assertion;
190
+ arguments: Assertion;
191
+ Arguments: Assertion;
192
+ finite: Assertion;
193
+ equal: Equal;
194
+ equals: Equal;
195
+ eq: Equal;
196
+ eql: Equal;
197
+ eqls: Equal;
198
+ property: Property;
199
+ ownProperty: Property;
200
+ haveOwnProperty: Property;
201
+ ownPropertyDescriptor: OwnPropertyDescriptor;
202
+ haveOwnPropertyDescriptor: OwnPropertyDescriptor;
203
+ length: Length;
204
+ lengthOf: Length;
205
+ match: Match;
206
+ matches: Match;
207
+ string(string: string, message?: string): Assertion;
208
+ keys: Keys;
209
+ key(string: string): Assertion;
210
+ throw: Throw;
211
+ throws: Throw;
212
+ Throw: Throw;
213
+ respondTo: RespondTo;
214
+ respondsTo: RespondTo;
215
+ itself: Assertion;
216
+ satisfy: Satisfy;
217
+ satisfies: Satisfy;
218
+ closeTo: CloseTo;
219
+ approximately: CloseTo;
220
+ members: Members;
221
+ increase: PropertyChange;
222
+ increases: PropertyChange;
223
+ decrease: PropertyChange;
224
+ decreases: PropertyChange;
225
+ change: PropertyChange;
226
+ changes: PropertyChange;
227
+ extensible: Assertion;
228
+ sealed: Assertion;
229
+ frozen: Assertion;
230
+ oneOf: OneOf;
231
+ }
232
+
233
+ interface LanguageChains {
234
+ to: Assertion;
235
+ be: Assertion;
236
+ been: Assertion;
237
+ is: Assertion;
238
+ that: Assertion;
239
+ which: Assertion;
240
+ and: Assertion;
241
+ has: Assertion;
242
+ have: Assertion;
243
+ with: Assertion;
244
+ at: Assertion;
245
+ of: Assertion;
246
+ same: Assertion;
247
+ but: Assertion;
248
+ does: Assertion;
249
+ }
250
+
251
+ interface NumericComparison {
252
+ above: NumberComparer;
253
+ gt: NumberComparer;
254
+ greaterThan: NumberComparer;
255
+ least: NumberComparer;
256
+ gte: NumberComparer;
257
+ greaterThanOrEqual: NumberComparer;
258
+ below: NumberComparer;
259
+ lt: NumberComparer;
260
+ lessThan: NumberComparer;
261
+ most: NumberComparer;
262
+ lte: NumberComparer;
263
+ lessThanOrEqual: NumberComparer;
264
+ within(start: number, finish: number, message?: string): Assertion;
265
+ within(start: Date, finish: Date, message?: string): Assertion;
266
+ }
267
+
268
+ interface NumberComparer {
269
+ (value: number | Date, message?: string): Assertion;
270
+ }
271
+
272
+ interface TypeComparison {
273
+ (type: string, message?: string): Assertion;
274
+ instanceof: InstanceOf;
275
+ instanceOf: InstanceOf;
276
+ }
277
+
278
+ interface InstanceOf {
279
+ (constructor: any, message?: string): Assertion;
280
+ }
281
+
282
+ interface CloseTo {
283
+ (expected: number, delta: number, message?: string): Assertion;
284
+ }
285
+
286
+ interface Nested {
287
+ include: Include;
288
+ includes: Include;
289
+ contain: Include;
290
+ contains: Include;
291
+ property: Property;
292
+ members: Members;
293
+ }
294
+
295
+ interface Own {
296
+ include: Include;
297
+ includes: Include;
298
+ contain: Include;
299
+ contains: Include;
300
+ property: Property;
301
+ }
302
+
303
+ interface Deep extends KeyFilter {
304
+ be: Assertion;
305
+ equal: Equal;
306
+ equals: Equal;
307
+ eq: Equal;
308
+ include: Include;
309
+ includes: Include;
310
+ contain: Include;
311
+ contains: Include;
312
+ property: Property;
313
+ ordered: Ordered;
314
+ nested: Nested;
315
+ oneOf: OneOf;
316
+ own: Own;
317
+ }
318
+
319
+ interface Ordered {
320
+ members: Members;
321
+ }
322
+
323
+ interface KeyFilter {
324
+ keys: Keys;
325
+ members: Members;
326
+ }
327
+
328
+ interface Equal {
329
+ (value: any, message?: string): Assertion;
330
+ }
331
+
332
+ interface Property {
333
+ (name: string | symbol, value: any, message?: string): Assertion;
334
+ (name: string | symbol, message?: string): Assertion;
335
+ }
336
+
337
+ interface OwnPropertyDescriptor {
338
+ (name: string | symbol, descriptor: PropertyDescriptor, message?: string): Assertion;
339
+ (name: string | symbol, message?: string): Assertion;
340
+ }
341
+
342
+ interface Length extends LanguageChains, NumericComparison {
343
+ (length: number, message?: string): Assertion;
344
+ }
345
+
346
+ interface Include {
347
+ (value: any, message?: string): Assertion;
348
+ keys: Keys;
349
+ deep: Deep;
350
+ ordered: Ordered;
351
+ members: Members;
352
+ any: KeyFilter;
353
+ all: KeyFilter;
354
+ oneOf: OneOf;
355
+ }
356
+
357
+ interface OneOf {
358
+ (list: readonly unknown[], message?: string): Assertion;
359
+ }
360
+
361
+ interface Match {
362
+ (regexp: RegExp, message?: string): Assertion;
363
+ }
364
+
365
+ interface Keys {
366
+ (...keys: string[]): Assertion;
367
+ (keys: readonly any[] | Object): Assertion;
368
+ }
369
+
370
+ interface Throw {
371
+ (expected?: string | RegExp, message?: string): Assertion;
372
+ (constructor: Error | Function, expected?: string | RegExp, message?: string): Assertion;
373
+ }
374
+
375
+ interface RespondTo {
376
+ (method: string, message?: string): Assertion;
377
+ }
378
+
379
+ interface Satisfy {
380
+ (matcher: Function, message?: string): Assertion;
381
+ }
382
+
383
+ interface Members {
384
+ (set: readonly any[], message?: string): Assertion;
385
+ }
386
+
387
+ interface PropertyChange {
388
+ (object: Object, property?: string, message?: string): DeltaAssertion;
389
+ }
390
+
391
+ interface DeltaAssertion extends Assertion {
392
+ by(delta: number, msg?: string): Assertion;
393
+ }
394
+
395
+ export interface Assert {
396
+ /**
397
+ * @param expression Expression to test for truthiness.
398
+ * @param message Message to display on error.
399
+ */
400
+ (expression: any, message?: string): asserts expression;
401
+
402
+ /**
403
+ * Throws a failure.
404
+ *
405
+ * @param message Message to display on error.
406
+ * @remarks Node.js assert module-compatible.
407
+ */
408
+ fail(message?: string): never;
409
+
410
+ /**
411
+ * Throws a failure.
412
+ *
413
+ * T Type of the objects.
414
+ * @param actual Actual value.
415
+ * @param expected Potential expected value.
416
+ * @param message Message to display on error.
417
+ * @param operator Comparison operator, if not strict equality.
418
+ * @remarks Node.js assert module-compatible.
419
+ */
420
+ fail<T>(actual: T, expected: T, message?: string, operator?: Operator): never;
421
+
422
+ /**
423
+ * Asserts that object is truthy.
424
+ *
425
+ * @param object Object to test.
426
+ * @param message Message to display on error.
427
+ */
428
+ isOk(value: unknown, message?: string): asserts value;
429
+
430
+ /**
431
+ * Asserts that object is truthy.
432
+ *
433
+ * @param object Object to test.
434
+ * @param message Message to display on error.
435
+ */
436
+ ok(value: unknown, message?: string): asserts value;
437
+
438
+ /**
439
+ * Asserts that object is falsy.
440
+ *
441
+ * T Type of object.
442
+ * @param object Object to test.
443
+ * @param message Message to display on error.
444
+ */
445
+ isNotOk<T>(value: T, message?: string): void;
446
+
447
+ /**
448
+ * Asserts that object is falsy.
449
+ *
450
+ * T Type of object.
451
+ * @param object Object to test.
452
+ * @param message Message to display on error.
453
+ */
454
+ notOk<T>(value: T, message?: string): void;
455
+
456
+ /**
457
+ * Asserts non-strict equality (==) of actual and expected.
458
+ *
459
+ * T Type of the objects.
460
+ * @param actual Actual value.
461
+ * @param expected Potential expected value.
462
+ * @param message Message to display on error.
463
+ */
464
+ equal<T>(actual: T, expected: T, message?: string): void;
465
+
466
+ /**
467
+ * Asserts non-strict inequality (!=) of actual and expected.
468
+ *
469
+ * T Type of the objects.
470
+ * @param actual Actual value.
471
+ * @param expected Potential expected value.
472
+ * @param message Message to display on error.
473
+ */
474
+ notEqual<T>(actual: T, expected: T, message?: string): void;
475
+
476
+ /**
477
+ * Asserts strict equality (===) of actual and expected.
478
+ *
479
+ * T Type of the objects.
480
+ * @param actual Actual value.
481
+ * @param expected Potential expected value.
482
+ * @param message Message to display on error.
483
+ */
484
+ strictEqual<T>(actual: T, expected: T, message?: string): void;
485
+
486
+ /**
487
+ * Asserts strict inequality (!==) of actual and expected.
488
+ *
489
+ * T Type of the objects.
490
+ * @param actual Actual value.
491
+ * @param expected Potential expected value.
492
+ * @param message Message to display on error.
493
+ */
494
+ notStrictEqual<T>(actual: T, expected: T, message?: string): void;
495
+
496
+ /**
497
+ * Asserts that actual is deeply equal to expected.
498
+ *
499
+ * T Type of the objects.
500
+ * @param actual Actual value.
501
+ * @param expected Potential expected value.
502
+ * @param message Message to display on error.
503
+ */
504
+ deepEqual<T>(actual: T, expected: T, message?: string): void;
505
+
506
+ /**
507
+ * Asserts that actual is not deeply equal to expected.
508
+ *
509
+ * T Type of the objects.
510
+ * @param actual Actual value.
511
+ * @param expected Potential expected value.
512
+ * @param message Message to display on error.
513
+ */
514
+ notDeepEqual<T>(actual: T, expected: T, message?: string): void;
515
+
516
+ /**
517
+ * Alias to deepEqual
518
+ *
519
+ * T Type of the objects.
520
+ * @param actual Actual value.
521
+ * @param expected Potential expected value.
522
+ * @param message Message to display on error.
523
+ */
524
+ deepStrictEqual<T>(actual: T, expected: T, message?: string): void;
525
+
526
+ /**
527
+ * Asserts valueToCheck is strictly greater than (>) valueToBeAbove.
528
+ *
529
+ * @param valueToCheck Actual value.
530
+ * @param valueToBeAbove Minimum Potential expected value.
531
+ * @param message Message to display on error.
532
+ */
533
+ isAbove(valueToCheck: number, valueToBeAbove: number, message?: string): void;
534
+
535
+ /**
536
+ * Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast.
537
+ *
538
+ * @param valueToCheck Actual value.
539
+ * @param valueToBeAtLeast Minimum Potential expected value.
540
+ * @param message Message to display on error.
541
+ */
542
+ isAtLeast(valueToCheck: number, valueToBeAtLeast: number, message?: string): void;
543
+
544
+ /**
545
+ * Asserts valueToCheck is strictly less than (<) valueToBeBelow.
546
+ *
547
+ * @param valueToCheck Actual value.
548
+ * @param valueToBeBelow Minimum Potential expected value.
549
+ * @param message Message to display on error.
550
+ */
551
+ isBelow(valueToCheck: number, valueToBeBelow: number, message?: string): void;
552
+
553
+ /**
554
+ * Asserts valueToCheck is less than or equal to (<=) valueToBeAtMost.
555
+ *
556
+ * @param valueToCheck Actual value.
557
+ * @param valueToBeAtMost Minimum Potential expected value.
558
+ * @param message Message to display on error.
559
+ */
560
+ isAtMost(valueToCheck: number, valueToBeAtMost: number, message?: string): void;
561
+
562
+ /**
563
+ * Asserts that value is true.
564
+ *
565
+ * @param value Actual value.
566
+ * @param message Message to display on error.
567
+ */
568
+ isTrue(value: unknown, message?: string): asserts value is true;
569
+
570
+ /**
571
+ * Asserts that value is false.
572
+ *
573
+ * @param value Actual value.
574
+ * @param message Message to display on error.
575
+ */
576
+ isFalse(value: unknown, message?: string): asserts value is false;
577
+
578
+ /**
579
+ * Asserts that value is not true.
580
+ *
581
+ * T Type of value.
582
+ * @param value Actual value.
583
+ * @param message Message to display on error.
584
+ */
585
+ isNotTrue<T>(value: T, message?: string): asserts value is Exclude<T, true>;
586
+
587
+ /**
588
+ * Asserts that value is not false.
589
+ *
590
+ * @param value Actual value.
591
+ * @param message Message to display on error.
592
+ */
593
+ isNotFalse<T>(value: T, message?: string): asserts value is Exclude<T, false>;
594
+
595
+ /**
596
+ * Asserts that value is null.
597
+ *
598
+ * @param value Actual value.
599
+ * @param message Message to display on error.
600
+ */
601
+ isNull(value: unknown, message?: string): asserts value is null;
602
+
603
+ /**
604
+ * Asserts that value is not null.
605
+ *
606
+ * T Type of value.
607
+ * @param value Actual value.
608
+ * @param message Message to display on error.
609
+ */
610
+ isNotNull<T>(value: T, message?: string): asserts value is Exclude<T, null>;
611
+
612
+ /**
613
+ * Asserts that value is NaN.
614
+ *
615
+ * T Type of value.
616
+ * @param value Actual value.
617
+ * @param message Message to display on error.
618
+ */
619
+ isNaN<T>(value: T, message?: string): void;
620
+
621
+ /**
622
+ * Asserts that value is not NaN.
623
+ *
624
+ * T Type of value.
625
+ * @param value Actual value.
626
+ * @param message Message to display on error.
627
+ */
628
+ isNotNaN<T>(value: T, message?: string): void;
629
+
630
+ /**
631
+ * Asserts that the target is neither null nor undefined.
632
+ *
633
+ * T Type of value.
634
+ * @param value Actual value.
635
+ * @param message Message to display on error.
636
+ */
637
+ exists<T>(value: T, message?: string): asserts value is NonNullable<T>;
638
+
639
+ /**
640
+ * Asserts that the target is either null or undefined.
641
+ *
642
+ * @param value Actual value.
643
+ * @param message Message to display on error.
644
+ */
645
+ notExists(value: unknown, message?: string): asserts value is
646
+ | null
647
+ | undefined;
648
+
649
+ /**
650
+ * Asserts that value is undefined.
651
+ *
652
+ * @param value Actual value.
653
+ * @param message Message to display on error.
654
+ */
655
+ isUndefined(value: unknown, message?: string): asserts value is undefined;
656
+
657
+ /**
658
+ * Asserts that value is not undefined.
659
+ *
660
+ * T Type of value.
661
+ * @param value Actual value.
662
+ * @param message Message to display on error.
663
+ */
664
+ isDefined<T>(value: T, message?: string): asserts value is Exclude<T, undefined>;
665
+
666
+ /**
667
+ * Asserts that value is a function.
668
+ *
669
+ * T Type of value.
670
+ * @param value Actual value.
671
+ * @param message Message to display on error.
672
+ */
673
+ isFunction<T>(value: T, message?: string): void;
674
+
675
+ /**
676
+ * Asserts that value is not a function.
677
+ *
678
+ * T Type of value.
679
+ * @param value Actual value.
680
+ * @param message Message to display on error.
681
+ */
682
+ isNotFunction<T>(value: T, message?: string): void;
683
+
684
+ /**
685
+ * Asserts that value is an object of type 'Object'
686
+ * (as revealed by Object.prototype.toString).
687
+ *
688
+ * T Type of value.
689
+ * @param value Actual value.
690
+ * @param message Message to display on error.
691
+ * @remarks The assertion does not match subclassed objects.
692
+ */
693
+ isObject<T>(value: T, message?: string): void;
694
+
695
+ /**
696
+ * Asserts that value is not an object of type 'Object'
697
+ * (as revealed by Object.prototype.toString).
698
+ *
699
+ * T Type of value.
700
+ * @param value Actual value.
701
+ * @param message Message to display on error.
702
+ */
703
+ isNotObject<T>(value: T, message?: string): void;
704
+
705
+ /**
706
+ * Asserts that value is an array.
707
+ *
708
+ * T Type of value.
709
+ * @param value Actual value.
710
+ * @param message Message to display on error.
711
+ */
712
+ isArray<T>(value: T, message?: string): void;
713
+
714
+ /**
715
+ * Asserts that value is not an array.
716
+ *
717
+ * T Type of value.
718
+ * @param value Actual value.
719
+ * @param message Message to display on error.
720
+ */
721
+ isNotArray<T>(value: T, message?: string): void;
722
+
723
+ /**
724
+ * Asserts that value is a string.
725
+ *
726
+ * T Type of value.
727
+ * @param value Actual value.
728
+ * @param message Message to display on error.
729
+ */
730
+ isString<T>(value: T, message?: string): void;
731
+
732
+ /**
733
+ * Asserts that value is not a string.
734
+ *
735
+ * T Type of value.
736
+ * @param value Actual value.
737
+ * @param message Message to display on error.
738
+ */
739
+ isNotString<T>(value: T, message?: string): void;
740
+
741
+ /**
742
+ * Asserts that value is a number.
743
+ *
744
+ * T Type of value.
745
+ * @param value Actual value.
746
+ * @param message Message to display on error.
747
+ */
748
+ isNumber<T>(value: T, message?: string): void;
749
+
750
+ /**
751
+ * Asserts that value is not a number.
752
+ *
753
+ * T Type of value.
754
+ * @param value Actual value.
755
+ * @param message Message to display on error.
756
+ */
757
+ isNotNumber<T>(value: T, message?: string): void;
758
+
759
+ /**
760
+ * Asserts that value is a finite number.
761
+ * Unlike `.isNumber`, this will fail for `NaN` and `Infinity`.
762
+ *
763
+ * T Type of value
764
+ * @param value Actual value
765
+ * @param message Message to display on error.
766
+ */
767
+ isFinite<T>(value: T, message?: string): void;
768
+
769
+ /**
770
+ * Asserts that value is a boolean.
771
+ *
772
+ * T Type of value.
773
+ * @param value Actual value.
774
+ * @param message Message to display on error.
775
+ */
776
+ isBoolean<T>(value: T, message?: string): void;
777
+
778
+ /**
779
+ * Asserts that value is not a boolean.
780
+ *
781
+ * T Type of value.
782
+ * @param value Actual value.
783
+ * @param message Message to display on error.
784
+ */
785
+ isNotBoolean<T>(value: T, message?: string): void;
786
+
787
+ /**
788
+ * Asserts that value's type is name, as determined by Object.prototype.toString.
789
+ *
790
+ * T Type of value.
791
+ * @param value Actual value.
792
+ * @param name Potential expected type name of value.
793
+ * @param message Message to display on error.
794
+ */
795
+ typeOf<T>(value: T, name: string, message?: string): void;
796
+
797
+ /**
798
+ * Asserts that value's type is not name, as determined by Object.prototype.toString.
799
+ *
800
+ * T Type of value.
801
+ * @param value Actual value.
802
+ * @param name Potential expected type name of value.
803
+ * @param message Message to display on error.
804
+ */
805
+ notTypeOf<T>(value: T, name: string, message?: string): void;
806
+
807
+ /**
808
+ * Asserts that value is an instance of constructor.
809
+ *
810
+ * T Expected type of value.
811
+ * @param value Actual value.
812
+ * @param constructor Potential expected contructor of value.
813
+ * @param message Message to display on error.
814
+ */
815
+ instanceOf<T>(
816
+ value: unknown,
817
+ constructor: Constructor<T>,
818
+ message?: string,
819
+ ): asserts value is T;
820
+
821
+ /**
822
+ * Asserts that value is not an instance of constructor.
823
+ *
824
+ * T Type of value.
825
+ * U Type that value shouldn't be an instance of.
826
+ * @param value Actual value.
827
+ * @param constructor Potential expected contructor of value.
828
+ * @param message Message to display on error.
829
+ */
830
+ notInstanceOf<T, U>(value: T, type: Constructor<U>, message?: string): asserts value is Exclude<T, U>;
831
+
832
+ /**
833
+ * Asserts that haystack includes needle.
834
+ *
835
+ * @param haystack Container string.
836
+ * @param needle Potential substring of haystack.
837
+ * @param message Message to display on error.
838
+ */
839
+ include(haystack: string, needle: string, message?: string): void;
840
+
841
+ /**
842
+ * Asserts that haystack includes needle.
843
+ *
844
+ * T Type of values in haystack.
845
+ * @param haystack Container array, set or map.
846
+ * @param needle Potential value contained in haystack.
847
+ * @param message Message to display on error.
848
+ */
849
+ include<T>(
850
+ haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
851
+ needle: T,
852
+ message?: string,
853
+ ): void;
854
+
855
+ /**
856
+ * Asserts that haystack includes needle.
857
+ *
858
+ * T Type of values in haystack.
859
+ * @param haystack WeakSet container.
860
+ * @param needle Potential value contained in haystack.
861
+ * @param message Message to display on error.
862
+ */
863
+ include<T extends object>(haystack: WeakSet<T>, needle: T, message?: string): void;
864
+
865
+ /**
866
+ * Asserts that haystack includes needle.
867
+ *
868
+ * T Type of haystack.
869
+ * @param haystack Object.
870
+ * @param needle Potential subset of the haystack's properties.
871
+ * @param message Message to display on error.
872
+ */
873
+ include<T>(haystack: T, needle: Partial<T>, message?: string): void;
874
+
875
+ /**
876
+ * Asserts that haystack does not include needle.
877
+ *
878
+ * @param haystack Container string.
879
+ * @param needle Potential substring of haystack.
880
+ * @param message Message to display on error.
881
+ */
882
+ notInclude(haystack: string, needle: string, message?: string): void;
883
+
884
+ /**
885
+ * Asserts that haystack does not include needle.
886
+ *
887
+ * T Type of values in haystack.
888
+ * @param haystack Container array, set or map.
889
+ * @param needle Potential value contained in haystack.
890
+ * @param message Message to display on error.
891
+ */
892
+ notInclude<T>(
893
+ haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
894
+ needle: T,
895
+ message?: string,
896
+ ): void;
897
+
898
+ /**
899
+ * Asserts that haystack does not include needle.
900
+ *
901
+ * T Type of values in haystack.
902
+ * @param haystack WeakSet container.
903
+ * @param needle Potential value contained in haystack.
904
+ * @param message Message to display on error.
905
+ */
906
+ notInclude<T extends object>(haystack: WeakSet<T>, needle: T, message?: string): void;
907
+
908
+ /**
909
+ * Asserts that haystack does not include needle.
910
+ *
911
+ * T Type of haystack.
912
+ * @param haystack Object.
913
+ * @param needle Potential subset of the haystack's properties.
914
+ * @param message Message to display on error.
915
+ */
916
+ notInclude<T>(haystack: T, needle: Partial<T>, message?: string): void;
917
+
918
+ /**
919
+ * Asserts that haystack includes needle. Deep equality is used.
920
+ *
921
+ * @param haystack Container string.
922
+ * @param needle Potential substring of haystack.
923
+ * @param message Message to display on error.
924
+ *
925
+ * @deprecated Does not have any effect on string. Use {@link Assert#include} instead.
926
+ */
927
+ deepInclude(haystack: string, needle: string, message?: string): void;
928
+
929
+ /**
930
+ * Asserts that haystack includes needle. Deep equality is used.
931
+ *
932
+ * T Type of values in haystack.
933
+ * @param haystack Container array, set or map.
934
+ * @param needle Potential value contained in haystack.
935
+ * @param message Message to display on error.
936
+ */
937
+ deepInclude<T>(
938
+ haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
939
+ needle: T,
940
+ message?: string,
941
+ ): void;
942
+
943
+ /**
944
+ * Asserts that haystack includes needle. Deep equality is used.
945
+ *
946
+ * T Type of haystack.
947
+ * @param haystack Object.
948
+ * @param needle Potential subset of the haystack's properties.
949
+ * @param message Message to display on error.
950
+ */
951
+ deepInclude<T>(haystack: T, needle: T extends WeakSet<any> ? never : Partial<T>, message?: string): void;
952
+
953
+ /**
954
+ * Asserts that haystack does not include needle. Deep equality is used.
955
+ *
956
+ * @param haystack Container string.
957
+ * @param needle Potential substring of haystack.
958
+ * @param message Message to display on error.
959
+ *
960
+ * @deprecated Does not have any effect on string. Use {@link Assert#notInclude} instead.
961
+ */
962
+ notDeepInclude(haystack: string, needle: string, message?: string): void;
963
+
964
+ /**
965
+ * Asserts that haystack does not include needle. Deep equality is used.
966
+ *
967
+ * T Type of values in haystack.
968
+ * @param haystack Container array, set or map.
969
+ * @param needle Potential value contained in haystack.
970
+ * @param message Message to display on error.
971
+ */
972
+ notDeepInclude<T>(
973
+ haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
974
+ needle: T,
975
+ message?: string,
976
+ ): void;
977
+
978
+ /**
979
+ * Asserts that haystack does not include needle. Deep equality is used.
980
+ *
981
+ * T Type of haystack.
982
+ * @param haystack Object.
983
+ * @param needle Potential subset of the haystack's properties.
984
+ * @param message Message to display on error.
985
+ */
986
+ notDeepInclude<T>(haystack: T, needle: T extends WeakSet<any> ? never : Partial<T>, message?: string): void;
987
+
988
+ /**
989
+ * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object.
990
+ *
991
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
992
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
993
+ * Can be used to assert the inclusion of a subset of properties in an object.
994
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
995
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
996
+ *
997
+ * @param haystack
998
+ * @param needle
999
+ * @param message Message to display on error.
1000
+ */
1001
+ nestedInclude(haystack: any, needle: any, message?: string): void;
1002
+
1003
+ /**
1004
+ * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object.
1005
+ *
1006
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
1007
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
1008
+ * Can be used to assert the inclusion of a subset of properties in an object.
1009
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
1010
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
1011
+ *
1012
+ * @param haystack
1013
+ * @param needle
1014
+ * @param message Message to display on error.
1015
+ */
1016
+ notNestedInclude(haystack: any, needle: any, message?: string): void;
1017
+
1018
+ /**
1019
+ * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while checking for deep equality
1020
+ *
1021
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
1022
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
1023
+ * Can be used to assert the inclusion of a subset of properties in an object.
1024
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
1025
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
1026
+ *
1027
+ * @param haystack
1028
+ * @param needle
1029
+ * @param message Message to display on error.
1030
+ */
1031
+ deepNestedInclude(haystack: any, needle: any, message?: string): void;
1032
+
1033
+ /**
1034
+ * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object while checking for deep equality.
1035
+ *
1036
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
1037
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
1038
+ * Can be used to assert the inclusion of a subset of properties in an object.
1039
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
1040
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
1041
+ *
1042
+ * @param haystack
1043
+ * @param needle
1044
+ * @param message Message to display on error.
1045
+ */
1046
+ notDeepNestedInclude(haystack: any, needle: any, message?: string): void;
1047
+
1048
+ /**
1049
+ * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties.
1050
+ *
1051
+ * @param haystack
1052
+ * @param needle
1053
+ * @param message Message to display on error.
1054
+ */
1055
+ ownInclude(haystack: any, needle: any, message?: string): void;
1056
+
1057
+ /**
1058
+ * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties.
1059
+ *
1060
+ * @param haystack
1061
+ * @param needle
1062
+ * @param message Message to display on error.
1063
+ */
1064
+ notOwnInclude(haystack: any, needle: any, message?: string): void;
1065
+
1066
+ /**
1067
+ * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties and checking for deep
1068
+ *
1069
+ * @param haystack
1070
+ * @param needle
1071
+ * @param message Message to display on error.
1072
+ */
1073
+ deepOwnInclude(haystack: any, needle: any, message?: string): void;
1074
+
1075
+ /**
1076
+ * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties and checking for deep equality.
1077
+ *
1078
+ * @param haystack
1079
+ * @param needle
1080
+ * @param message Message to display on error.
1081
+ */
1082
+ notDeepOwnInclude(haystack: any, needle: any, message?: string): void;
1083
+
1084
+ /**
1085
+ * Asserts that value matches the regular expression regexp.
1086
+ *
1087
+ * @param value Actual value.
1088
+ * @param regexp Potential match of value.
1089
+ * @param message Message to display on error.
1090
+ */
1091
+ match(value: string, regexp: RegExp, message?: string): void;
1092
+
1093
+ /**
1094
+ * Asserts that value does not match the regular expression regexp.
1095
+ *
1096
+ * @param value Actual value.
1097
+ * @param regexp Potential match of value.
1098
+ * @param message Message to display on error.
1099
+ */
1100
+ notMatch(expected: any, regexp: RegExp, message?: string): void;
1101
+
1102
+ /**
1103
+ * Asserts that object has a property named by property.
1104
+ *
1105
+ * T Type of object.
1106
+ * @param object Container object.
1107
+ * @param property Potential contained property of object.
1108
+ * @param message Message to display on error.
1109
+ */
1110
+ property<T>(object: T, property: string, /* keyof T */ message?: string): void;
1111
+
1112
+ /**
1113
+ * Asserts that object does not have a property named by property.
1114
+ *
1115
+ * T Type of object.
1116
+ * @param object Container object.
1117
+ * @param property Potential contained property of object.
1118
+ * @param message Message to display on error.
1119
+ */
1120
+ notProperty<T>(object: T, property: string, /* keyof T */ message?: string): void;
1121
+
1122
+ /**
1123
+ * Asserts that object has a property named by property, which can be a string
1124
+ * using dot- and bracket-notation for deep reference.
1125
+ *
1126
+ * T Type of object.
1127
+ * @param object Container object.
1128
+ * @param property Potential contained property of object.
1129
+ * @param message Message to display on error.
1130
+ */
1131
+ deepProperty<T>(object: T, property: string, message?: string): void;
1132
+
1133
+ /**
1134
+ * Asserts that object does not have a property named by property, which can be a
1135
+ * string using dot- and bracket-notation for deep reference.
1136
+ *
1137
+ * T Type of object.
1138
+ * @param object Container object.
1139
+ * @param property Potential contained property of object.
1140
+ * @param message Message to display on error.
1141
+ */
1142
+ notDeepProperty<T>(object: T, property: string, message?: string): void;
1143
+
1144
+ /**
1145
+ * Asserts that object has a property named by property with value given by value.
1146
+ *
1147
+ * T Type of object.
1148
+ * V Type of value.
1149
+ * @param object Container object.
1150
+ * @param property Potential contained property of object.
1151
+ * @param value Potential expected property value.
1152
+ * @param message Message to display on error.
1153
+ */
1154
+ propertyVal<T, V>(object: T, property: string, /* keyof T */ value: V, message?: string): void;
1155
+
1156
+ /**
1157
+ * Asserts that object has a property named by property with value given by value.
1158
+ *
1159
+ * T Type of object.
1160
+ * V Type of value.
1161
+ * @param object Container object.
1162
+ * @param property Potential contained property of object.
1163
+ * @param value Potential expected property value.
1164
+ * @param message Message to display on error.
1165
+ */
1166
+ notPropertyVal<T, V>(object: T, property: string, /* keyof T */ value: V, message?: string): void;
1167
+
1168
+ /**
1169
+ * Asserts that object has a property named by property, which can be a string
1170
+ * using dot- and bracket-notation for deep reference.
1171
+ *
1172
+ * T Type of object.
1173
+ * V Type of value.
1174
+ * @param object Container object.
1175
+ * @param property Potential contained property of object.
1176
+ * @param value Potential expected property value.
1177
+ * @param message Message to display on error.
1178
+ */
1179
+ deepPropertyVal<T, V>(object: T, property: string, value: V, message?: string): void;
1180
+
1181
+ /**
1182
+ * Asserts that object does not have a property named by property, which can be a
1183
+ * string using dot- and bracket-notation for deep reference.
1184
+ *
1185
+ * T Type of object.
1186
+ * V Type of value.
1187
+ * @param object Container object.
1188
+ * @param property Potential contained property of object.
1189
+ * @param value Potential expected property value.
1190
+ * @param message Message to display on error.
1191
+ */
1192
+ notDeepPropertyVal<T, V>(object: T, property: string, value: V, message?: string): void;
1193
+
1194
+ /**
1195
+ * Asserts that object has a length property with the expected value.
1196
+ *
1197
+ * T Type of object.
1198
+ * @param object Container object.
1199
+ * @param length Potential expected length of object.
1200
+ * @param message Message to display on error.
1201
+ */
1202
+ lengthOf<T extends { readonly length?: number | undefined } | { readonly size?: number | undefined }>(
1203
+ object: T,
1204
+ length: number,
1205
+ message?: string,
1206
+ ): void;
1207
+
1208
+ /**
1209
+ * Asserts that fn will throw an error.
1210
+ *
1211
+ * @param fn Function that may throw.
1212
+ * @param errMsgMatcher Expected error message matcher.
1213
+ * @param ignored Ignored parameter.
1214
+ * @param message Message to display on error.
1215
+ */
1216
+ throw(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void;
1217
+
1218
+ /**
1219
+ * Asserts that fn will throw an error.
1220
+ *
1221
+ * @param fn Function that may throw.
1222
+ * @param errorLike Expected error constructor or error instance.
1223
+ * @param errMsgMatcher Expected error message matcher.
1224
+ * @param message Message to display on error.
1225
+ */
1226
+ throw(
1227
+ fn: () => void,
1228
+ errorLike?: ErrorConstructor | Error | null,
1229
+ errMsgMatcher?: RegExp | string | null,
1230
+ message?: string,
1231
+ ): void;
1232
+
1233
+ /**
1234
+ * Asserts that fn will throw an error.
1235
+ *
1236
+ * @param fn Function that may throw.
1237
+ * @param errMsgMatcher Expected error message matcher.
1238
+ * @param ignored Ignored parameter.
1239
+ * @param message Message to display on error.
1240
+ */
1241
+ throws(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void;
1242
+
1243
+ /**
1244
+ * Asserts that fn will throw an error.
1245
+ *
1246
+ * @param fn Function that may throw.
1247
+ * @param errorLike Expected error constructor or error instance.
1248
+ * @param errMsgMatcher Expected error message matcher.
1249
+ * @param message Message to display on error.
1250
+ */
1251
+ throws(
1252
+ fn: () => void,
1253
+ errorLike?: ErrorConstructor | Error | null,
1254
+ errMsgMatcher?: RegExp | string | null,
1255
+ message?: string,
1256
+ ): void;
1257
+
1258
+ /**
1259
+ * Asserts that fn will throw an error.
1260
+ *
1261
+ * @param fn Function that may throw.
1262
+ * @param errMsgMatcher Expected error message matcher.
1263
+ * @param ignored Ignored parameter.
1264
+ * @param message Message to display on error.
1265
+ */
1266
+ Throw(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void;
1267
+
1268
+ /**
1269
+ * Asserts that fn will throw an error.
1270
+ *
1271
+ * @param fn Function that may throw.
1272
+ * @param errorLike Expected error constructor or error instance.
1273
+ * @param errMsgMatcher Expected error message matcher.
1274
+ * @param message Message to display on error.
1275
+ */
1276
+ Throw(
1277
+ fn: () => void,
1278
+ errorLike?: ErrorConstructor | Error | null,
1279
+ errMsgMatcher?: RegExp | string | null,
1280
+ message?: string,
1281
+ ): void;
1282
+
1283
+ /**
1284
+ * Asserts that fn will not throw an error.
1285
+ *
1286
+ * @param fn Function that may throw.
1287
+ * @param errMsgMatcher Expected error message matcher.
1288
+ * @param ignored Ignored parameter.
1289
+ * @param message Message to display on error.
1290
+ */
1291
+ doesNotThrow(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void;
1292
+
1293
+ /**
1294
+ * Asserts that fn will not throw an error.
1295
+ *
1296
+ * @param fn Function that may throw.
1297
+ * @param errorLike Expected error constructor or error instance.
1298
+ * @param errMsgMatcher Expected error message matcher.
1299
+ * @param message Message to display on error.
1300
+ */
1301
+ doesNotThrow(
1302
+ fn: () => void,
1303
+ errorLike?: ErrorConstructor | Error | null,
1304
+ errMsgMatcher?: RegExp | string | null,
1305
+ message?: string,
1306
+ ): void;
1307
+
1308
+ /**
1309
+ * Compares two values using operator.
1310
+ *
1311
+ * @param val1 Left value during comparison.
1312
+ * @param operator Comparison operator.
1313
+ * @param val2 Right value during comparison.
1314
+ * @param message Message to display on error.
1315
+ */
1316
+ operator(val1: OperatorComparable, operator: Operator, val2: OperatorComparable, message?: string): void;
1317
+
1318
+ /**
1319
+ * Asserts that the target is equal to expected, to within a +/- delta range.
1320
+ *
1321
+ * @param actual Actual value
1322
+ * @param expected Potential expected value.
1323
+ * @param delta Maximum differenced between values.
1324
+ * @param message Message to display on error.
1325
+ */
1326
+ closeTo(actual: number, expected: number, delta: number, message?: string): void;
1327
+
1328
+ /**
1329
+ * Asserts that the target is equal to expected, to within a +/- delta range.
1330
+ *
1331
+ * @param actual Actual value
1332
+ * @param expected Potential expected value.
1333
+ * @param delta Maximum differenced between values.
1334
+ * @param message Message to display on error.
1335
+ */
1336
+ approximately(act: number, exp: number, delta: number, message?: string): void;
1337
+
1338
+ /**
1339
+ * Asserts that set1 and set2 have the same members. Order is not take into account.
1340
+ *
1341
+ * T Type of set values.
1342
+ * @param set1 Actual set of values.
1343
+ * @param set2 Potential expected set of values.
1344
+ * @param message Message to display on error.
1345
+ */
1346
+ sameMembers<T>(set1: T[], set2: T[], message?: string): void;
1347
+
1348
+ /**
1349
+ * Asserts that set1 and set2 have the same members using deep equality checking.
1350
+ * Order is not take into account.
1351
+ *
1352
+ * T Type of set values.
1353
+ * @param set1 Actual set of values.
1354
+ * @param set2 Potential expected set of values.
1355
+ * @param message Message to display on error.
1356
+ */
1357
+ sameDeepMembers<T>(set1: T[], set2: T[], message?: string): void;
1358
+
1359
+ /**
1360
+ * Asserts that `set1` and `set2` don't have the same members in any order.
1361
+ * Uses a deep equality check.
1362
+ *
1363
+ * T Type of set values.
1364
+ * @param set1
1365
+ * @param set2
1366
+ * @param message
1367
+ */
1368
+ notSameDeepMembers<T>(set1: T[], set2: T[], message?: string): void;
1369
+
1370
+ /**
1371
+ * Asserts that set1 and set2 have the same members in the same order.
1372
+ * Uses a strict equality check (===).
1373
+ *
1374
+ * T Type of set values.
1375
+ * @param set1 Actual set of values.
1376
+ * @param set2 Potential expected set of values.
1377
+ * @param message Message to display on error.
1378
+ */
1379
+ sameOrderedMembers<T>(set1: T[], set2: T[], message?: string): void;
1380
+
1381
+ /**
1382
+ * Asserts that set1 and set2 don’t have the same members in the same order.
1383
+ * Uses a strict equality check (===).
1384
+ *
1385
+ * T Type of set values.
1386
+ * @param set1 Actual set of values.
1387
+ * @param set2 Potential expected set of values.
1388
+ * @param message Message to display on error.
1389
+ */
1390
+ notSameOrderedMembers<T>(set1: T[], set2: T[], message?: string): void;
1391
+
1392
+ /**
1393
+ * Asserts that set1 and set2 have the same members in the same order.
1394
+ * Uses a deep equality check.
1395
+ *
1396
+ * T Type of set values.
1397
+ * @param set1 Actual set of values.
1398
+ * @param set2 Potential expected set of values.
1399
+ * @param message Message to display on error.
1400
+ */
1401
+ sameDeepOrderedMembers<T>(set1: T[], set2: T[], message?: string): void;
1402
+
1403
+ /**
1404
+ * Asserts that set1 and set2 don’t have the same members in the same order.
1405
+ * Uses a deep equality check.
1406
+ *
1407
+ * T Type of set values.
1408
+ * @param set1 Actual set of values.
1409
+ * @param set2 Potential expected set of values.
1410
+ * @param message Message to display on error.
1411
+ */
1412
+ notSameDeepOrderedMembers<T>(set1: T[], set2: T[], message?: string): void;
1413
+
1414
+ /**
1415
+ * Asserts that subset is included in superset in the same order beginning with the first element in superset.
1416
+ * Uses a strict equality check (===).
1417
+ *
1418
+ * T Type of set values.
1419
+ * @param superset Actual set of values.
1420
+ * @param subset Potential contained set of values.
1421
+ * @param message Message to display on error.
1422
+ */
1423
+ includeOrderedMembers<T>(superset: T[], subset: T[], message?: string): void;
1424
+
1425
+ /**
1426
+ * Asserts that subset isn’t included in superset in the same order beginning with the first element in superset.
1427
+ * Uses a strict equality check (===).
1428
+ *
1429
+ * T Type of set values.
1430
+ * @param superset Actual set of values.
1431
+ * @param subset Potential contained set of values.
1432
+ * @param message Message to display on error.
1433
+ */
1434
+ notIncludeOrderedMembers<T>(superset: T[], subset: T[], message?: string): void;
1435
+
1436
+ /**
1437
+ * Asserts that subset is included in superset in the same order beginning with the first element in superset.
1438
+ * Uses a deep equality check.
1439
+ *
1440
+ * T Type of set values.
1441
+ * @param superset Actual set of values.
1442
+ * @param subset Potential contained set of values.
1443
+ * @param message Message to display on error.
1444
+ */
1445
+ includeDeepOrderedMembers<T>(superset: T[], subset: T[], message?: string): void;
1446
+
1447
+ /**
1448
+ * Asserts that subset isn’t included in superset in the same order beginning with the first element in superset.
1449
+ * Uses a deep equality check.
1450
+ *
1451
+ * T Type of set values.
1452
+ * @param superset Actual set of values.
1453
+ * @param subset Potential contained set of values.
1454
+ * @param message Message to display on error.
1455
+ */
1456
+ notIncludeDeepOrderedMembers<T>(superset: T[], subset: T[], message?: string): void;
1457
+
1458
+ /**
1459
+ * Asserts that subset is included in superset. Order is not take into account.
1460
+ *
1461
+ * T Type of set values.
1462
+ * @param superset Actual set of values.
1463
+ * @param subset Potential contained set of values.
1464
+ * @param message Message to display on error.
1465
+ */
1466
+ includeMembers<T>(superset: T[], subset: T[], message?: string): void;
1467
+
1468
+ /**
1469
+ * Asserts that subset isn’t included in superset in any order.
1470
+ * Uses a strict equality check (===). Duplicates are ignored.
1471
+ *
1472
+ * T Type of set values.
1473
+ * @param superset Actual set of values.
1474
+ * @param subset Potential not contained set of values.
1475
+ * @param message Message to display on error.
1476
+ */
1477
+ notIncludeMembers<T>(superset: T[], subset: T[], message?: string): void;
1478
+
1479
+ /**
1480
+ * Asserts that subset is included in superset using deep equality checking.
1481
+ * Order is not take into account.
1482
+ *
1483
+ * T Type of set values.
1484
+ * @param superset Actual set of values.
1485
+ * @param subset Potential contained set of values.
1486
+ * @param message Message to display on error.
1487
+ */
1488
+ includeDeepMembers<T>(superset: T[], subset: T[], message?: string): void;
1489
+
1490
+ /**
1491
+ * Asserts that `subset` isn't included in `superset` in any order. Uses a
1492
+ * deep equality check. Duplicates are ignored.
1493
+ *
1494
+ * assert.notIncludeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { f: 5 } ], 'not include deep members');
1495
+ *
1496
+ * T Type of set values.
1497
+ * @param superset Actual set of values.
1498
+ * @param subset Potential contained set of values.
1499
+ * @param message Message to display on error.
1500
+ */
1501
+ notIncludeDeepMembers<T>(superset: T[], subset: T[], message?: string): void;
1502
+
1503
+ /**
1504
+ * Asserts that non-object, non-array value inList appears in the flat array list.
1505
+ *
1506
+ * T Type of list values.
1507
+ * @param inList Value expected to be in the list.
1508
+ * @param list List of values.
1509
+ * @param message Message to display on error.
1510
+ */
1511
+ oneOf<T>(inList: T, list: T[], message?: string): void;
1512
+
1513
+ /**
1514
+ * Asserts that a function changes the value of a property.
1515
+ *
1516
+ * T Type of object.
1517
+ * @param modifier Function to run.
1518
+ * @param object Container object.
1519
+ * @param property Property of object expected to be modified.
1520
+ * @param message Message to display on error.
1521
+ */
1522
+ changes<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
1523
+
1524
+ /**
1525
+ * Asserts that a function changes the value of a property by an amount (delta).
1526
+ *
1527
+ * @param modifier function
1528
+ * @param object or getter function
1529
+ * @param property name _optional_
1530
+ * @param change amount (delta)
1531
+ * @param message _optional_
1532
+ */
1533
+ changesBy<T>(
1534
+ modifier: Function,
1535
+ object: T,
1536
+ property: string,
1537
+ /* keyof T */ change: number,
1538
+ message?: string,
1539
+ ): void;
1540
+ changesBy<T>(modifier: Function, object: T, change: number, message?: string): void;
1541
+
1542
+ /**
1543
+ * Asserts that a function does not change the value of a property.
1544
+ *
1545
+ * T Type of object.
1546
+ * @param modifier Function to run.
1547
+ * @param object Container object.
1548
+ * @param property Property of object expected not to be modified.
1549
+ * @param message Message to display on error.
1550
+ */
1551
+ doesNotChange<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
1552
+
1553
+ /**
1554
+ * Asserts that a function increases an object property.
1555
+ *
1556
+ * T Type of object.
1557
+ * @param modifier Function to run.
1558
+ * @param object Container object.
1559
+ * @param property Property of object expected to be increased.
1560
+ * @param message Message to display on error.
1561
+ */
1562
+ increases<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
1563
+
1564
+ /**
1565
+ * Asserts that a function increases a numeric object property or a function's return value by an amount (delta).
1566
+ *
1567
+ * T Type of object or function.
1568
+ * @param modifier function
1569
+ * @param object or getter function
1570
+ * @param property name _optional_
1571
+ * @param change amount (delta)
1572
+ * @param message _optional_
1573
+ */
1574
+ increasesBy<T>(
1575
+ modifier: Function,
1576
+ object: T,
1577
+ property: string,
1578
+ /* keyof T */ change: number,
1579
+ message?: string,
1580
+ ): void;
1581
+ increasesBy<T>(modifier: Function, object: T, change: number, message?: string): void;
1582
+
1583
+ /**
1584
+ * Asserts that a function does not increase an object property.
1585
+ *
1586
+ * T Type of object.
1587
+ * @param modifier Function to run.
1588
+ * @param object Container object.
1589
+ * @param property Property of object expected not to be increased.
1590
+ * @param message Message to display on error.
1591
+ */
1592
+ doesNotIncrease<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
1593
+
1594
+ /**
1595
+ * Asserts that a function does not increase a numeric object property or function's return value by an amount (delta).
1596
+ *
1597
+ * T Type of object or function.
1598
+ * @param modifier function
1599
+ * @param object or getter function
1600
+ * @param property name _optional_
1601
+ * @param change amount (delta)
1602
+ * @param message _optional_
1603
+ */
1604
+
1605
+ increasesButNotBy<T>(
1606
+ modifier: Function,
1607
+ object: T,
1608
+ property: string,
1609
+ /* keyof T */ change: number,
1610
+ message?: string,
1611
+ ): void;
1612
+ increasesButNotBy<T>(modifier: Function, object: T, change: number, message?: string): void;
1613
+
1614
+ /**
1615
+ * Asserts that a function decreases an object property.
1616
+ *
1617
+ * T Type of object.
1618
+ * @param modifier Function to run.
1619
+ * @param object Container object.
1620
+ * @param property Property of object expected to be decreased.
1621
+ * @param message Message to display on error.
1622
+ */
1623
+ decreases<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
1624
+
1625
+ /**
1626
+ * Asserts that a function decreases a numeric object property or a function's return value by an amount (delta)
1627
+ *
1628
+ * T Type of object or function.
1629
+ * @param modifier function
1630
+ * @param object or getter function
1631
+ * @param property name _optional_
1632
+ * @param change amount (delta)
1633
+ * @param message _optional_
1634
+ */
1635
+
1636
+ decreasesBy<T>(
1637
+ modifier: Function,
1638
+ object: T,
1639
+ property: string,
1640
+ /* keyof T */ change: number,
1641
+ message?: string,
1642
+ ): void;
1643
+ decreasesBy<T>(modifier: Function, object: T, change: number, message?: string): void;
1644
+
1645
+ /**
1646
+ * Asserts that a function does not decrease an object property.
1647
+ *
1648
+ * T Type of object.
1649
+ * @param modifier Function to run.
1650
+ * @param object Container object.
1651
+ * @param property Property of object expected not to be decreased.
1652
+ * @param message Message to display on error.
1653
+ */
1654
+ doesNotDecrease<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
1655
+
1656
+ /**
1657
+ * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta)
1658
+ *
1659
+ * T Type of object or function.
1660
+ * @param modifier function
1661
+ * @param object or getter function
1662
+ * @param property name _optional_
1663
+ * @param change amount (delta)
1664
+ * @param message _optional_
1665
+ */
1666
+
1667
+ doesNotDecreaseBy<T>(
1668
+ modifier: Function,
1669
+ object: T,
1670
+ property: string,
1671
+ /* keyof T */ change: number,
1672
+ message?: string,
1673
+ ): void;
1674
+ doesNotDecreaseBy<T>(modifier: Function, object: T, change: number, message?: string): void;
1675
+
1676
+ /**
1677
+ * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta)
1678
+ *
1679
+ * T Type of object or function.
1680
+ * @param modifier function
1681
+ * @param object or getter function
1682
+ * @param property name _optional_
1683
+ * @param change amount (delta)
1684
+ * @param message _optional_
1685
+ */
1686
+
1687
+ decreasesButNotBy<T>(
1688
+ modifier: Function,
1689
+ object: T,
1690
+ property: string,
1691
+ /* keyof T */ change: number,
1692
+ message?: string,
1693
+ ): void;
1694
+ decreasesButNotBy<T>(modifier: Function, object: T, change: number, message?: string): void;
1695
+
1696
+ /**
1697
+ * Asserts if value is not a false value, and throws if it is a true value.
1698
+ *
1699
+ * T Type of object.
1700
+ * @param object Actual value.
1701
+ * @param message Message to display on error.
1702
+ * @remarks This is added to allow for chai to be a drop-in replacement for
1703
+ * Node’s assert class.
1704
+ */
1705
+ ifError<T>(object: T, message?: string): void;
1706
+
1707
+ /**
1708
+ * Asserts that object is extensible (can have new properties added to it).
1709
+ *
1710
+ * T Type of object
1711
+ * @param object Actual value.
1712
+ * @param message Message to display on error.
1713
+ */
1714
+ isExtensible<T>(object: T, message?: string): void;
1715
+
1716
+ /**
1717
+ * Asserts that object is extensible (can have new properties added to it).
1718
+ *
1719
+ * T Type of object
1720
+ * @param object Actual value.
1721
+ * @param message Message to display on error.
1722
+ */
1723
+ extensible<T>(object: T, message?: string): void;
1724
+
1725
+ /**
1726
+ * Asserts that object is not extensible.
1727
+ *
1728
+ * T Type of object
1729
+ * @param object Actual value.
1730
+ * @param message Message to display on error.
1731
+ */
1732
+ isNotExtensible<T>(object: T, message?: string): void;
1733
+
1734
+ /**
1735
+ * Asserts that object is not extensible.
1736
+ *
1737
+ * T Type of object
1738
+ * @param object Actual value.
1739
+ * @param message Message to display on error.
1740
+ */
1741
+ notExtensible<T>(object: T, message?: string): void;
1742
+
1743
+ /**
1744
+ * Asserts that object is sealed (can have new properties added to it
1745
+ * and its existing properties cannot be removed).
1746
+ *
1747
+ * T Type of object
1748
+ * @param object Actual value.
1749
+ * @param message Message to display on error.
1750
+ */
1751
+ isSealed<T>(object: T, message?: string): void;
1752
+
1753
+ /**
1754
+ * Asserts that object is sealed (can have new properties added to it
1755
+ * and its existing properties cannot be removed).
1756
+ *
1757
+ * T Type of object
1758
+ * @param object Actual value.
1759
+ * @param message Message to display on error.
1760
+ */
1761
+ sealed<T>(object: T, message?: string): void;
1762
+
1763
+ /**
1764
+ * Asserts that object is not sealed.
1765
+ *
1766
+ * T Type of object
1767
+ * @param object Actual value.
1768
+ * @param message Message to display on error.
1769
+ */
1770
+ isNotSealed<T>(object: T, message?: string): void;
1771
+
1772
+ /**
1773
+ * Asserts that object is not sealed.
1774
+ *
1775
+ * T Type of object
1776
+ * @param object Actual value.
1777
+ * @param message Message to display on error.
1778
+ */
1779
+ notSealed<T>(object: T, message?: string): void;
1780
+
1781
+ /**
1782
+ * Asserts that object is frozen (cannot have new properties added to it
1783
+ * and its existing properties cannot be removed).
1784
+ *
1785
+ * T Type of object
1786
+ * @param object Actual value.
1787
+ * @param message Message to display on error.
1788
+ */
1789
+ isFrozen<T>(object: T, message?: string): void;
1790
+
1791
+ /**
1792
+ * Asserts that object is frozen (cannot have new properties added to it
1793
+ * and its existing properties cannot be removed).
1794
+ *
1795
+ * T Type of object
1796
+ * @param object Actual value.
1797
+ * @param message Message to display on error.
1798
+ */
1799
+ frozen<T>(object: T, message?: string): void;
1800
+
1801
+ /**
1802
+ * Asserts that object is not frozen (cannot have new properties added to it
1803
+ * and its existing properties cannot be removed).
1804
+ *
1805
+ * T Type of object
1806
+ * @param object Actual value.
1807
+ * @param message Message to display on error.
1808
+ */
1809
+ isNotFrozen<T>(object: T, message?: string): void;
1810
+
1811
+ /**
1812
+ * Asserts that object is not frozen (cannot have new properties added to it
1813
+ * and its existing properties cannot be removed).
1814
+ *
1815
+ * T Type of object
1816
+ * @param object Actual value.
1817
+ * @param message Message to display on error.
1818
+ */
1819
+ notFrozen<T>(object: T, message?: string): void;
1820
+
1821
+ /**
1822
+ * Asserts that the target does not contain any values. For arrays and
1823
+ * strings, it checks the length property. For Map and Set instances, it
1824
+ * checks the size property. For non-function objects, it gets the count
1825
+ * of own enumerable string keys.
1826
+ *
1827
+ * T Type of object
1828
+ * @param object Actual value.
1829
+ * @param message Message to display on error.
1830
+ */
1831
+ isEmpty<T>(object: T, message?: string): void;
1832
+
1833
+ /**
1834
+ * Asserts that the target contains values. For arrays and strings, it checks
1835
+ * the length property. For Map and Set instances, it checks the size property.
1836
+ * For non-function objects, it gets the count of own enumerable string keys.
1837
+ *
1838
+ * T Type of object.
1839
+ * @param object Object to test.
1840
+ * @param message Message to display on error.
1841
+ */
1842
+ isNotEmpty<T>(object: T, message?: string): void;
1843
+
1844
+ /**
1845
+ * Asserts that `object` has at least one of the `keys` provided.
1846
+ * You can also provide a single object instead of a `keys` array and its keys
1847
+ * will be used as the expected set of keys.
1848
+ *
1849
+ * T Type of object.
1850
+ * @param object Object to test.
1851
+ * @param keys Keys to check
1852
+ * @param message Message to display on error.
1853
+ */
1854
+ hasAnyKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
1855
+
1856
+ /**
1857
+ * Asserts that `object` has all and only all of the `keys` provided.
1858
+ * You can also provide a single object instead of a `keys` array and its keys
1859
+ * will be used as the expected set of keys.
1860
+ *
1861
+ * T Type of object.
1862
+ * @param object Object to test.
1863
+ * @param keys Keys to check
1864
+ * @param message Message to display on error.
1865
+ */
1866
+ hasAllKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
1867
+
1868
+ /**
1869
+ * Asserts that `object` has all of the `keys` provided but may have more keys not listed.
1870
+ * You can also provide a single object instead of a `keys` array and its keys
1871
+ * will be used as the expected set of keys.
1872
+ *
1873
+ * T Type of object.
1874
+ * @param object Object to test.
1875
+ * @param keys Keys to check
1876
+ * @param message Message to display on error.
1877
+ */
1878
+ containsAllKeys<T>(
1879
+ object: T,
1880
+ keys: Array<Object | string> | { [key: string]: any },
1881
+ message?: string,
1882
+ ): void;
1883
+
1884
+ /**
1885
+ * Asserts that `object` has none of the `keys` provided.
1886
+ * You can also provide a single object instead of a `keys` array and its keys
1887
+ * will be used as the expected set of keys.
1888
+ *
1889
+ * T Type of object.
1890
+ * @param object Object to test.
1891
+ * @param keys Keys to check
1892
+ * @param message Message to display on error.
1893
+ */
1894
+ doesNotHaveAnyKeys<T>(
1895
+ object: T,
1896
+ keys: Array<Object | string> | { [key: string]: any },
1897
+ message?: string,
1898
+ ): void;
1899
+
1900
+ /**
1901
+ * Asserts that `object` does not have at least one of the `keys` provided.
1902
+ * You can also provide a single object instead of a `keys` array and its keys
1903
+ * will be used as the expected set of keys.
1904
+ *
1905
+ * T Type of object.
1906
+ * @param object Object to test.
1907
+ * @param keys Keys to check
1908
+ * @param message Message to display on error.
1909
+ */
1910
+ doesNotHaveAllKeys<T>(
1911
+ object: T,
1912
+ keys: Array<Object | string> | { [key: string]: any },
1913
+ message?: string,
1914
+ ): void;
1915
+
1916
+ /**
1917
+ * Asserts that `object` has at least one of the `keys` provided.
1918
+ * Since Sets and Maps can have objects as keys you can use this assertion to perform
1919
+ * a deep comparison.
1920
+ * You can also provide a single object instead of a `keys` array and its keys
1921
+ * will be used as the expected set of keys.
1922
+ *
1923
+ * T Type of object.
1924
+ * @param object Object to test.
1925
+ * @param keys Keys to check
1926
+ * @param message Message to display on error.
1927
+ */
1928
+ hasAnyDeepKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
1929
+
1930
+ /**
1931
+ * Asserts that `object` has all and only all of the `keys` provided.
1932
+ * Since Sets and Maps can have objects as keys you can use this assertion to perform
1933
+ * a deep comparison.
1934
+ * You can also provide a single object instead of a `keys` array and its keys
1935
+ * will be used as the expected set of keys.
1936
+ *
1937
+ * T Type of object.
1938
+ * @param object Object to test.
1939
+ * @param keys Keys to check
1940
+ * @param message Message to display on error.
1941
+ */
1942
+ hasAllDeepKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
1943
+
1944
+ /**
1945
+ * Asserts that `object` contains all of the `keys` provided.
1946
+ * Since Sets and Maps can have objects as keys you can use this assertion to perform
1947
+ * a deep comparison.
1948
+ * You can also provide a single object instead of a `keys` array and its keys
1949
+ * will be used as the expected set of keys.
1950
+ *
1951
+ * T Type of object.
1952
+ * @param object Object to test.
1953
+ * @param keys Keys to check
1954
+ * @param message Message to display on error.
1955
+ */
1956
+ containsAllDeepKeys<T>(
1957
+ object: T,
1958
+ keys: Array<Object | string> | { [key: string]: any },
1959
+ message?: string,
1960
+ ): void;
1961
+
1962
+ /**
1963
+ * Asserts that `object` contains all of the `keys` provided.
1964
+ * Since Sets and Maps can have objects as keys you can use this assertion to perform
1965
+ * a deep comparison.
1966
+ * You can also provide a single object instead of a `keys` array and its keys
1967
+ * will be used as the expected set of keys.
1968
+ *
1969
+ * T Type of object.
1970
+ * @param object Object to test.
1971
+ * @param keys Keys to check
1972
+ * @param message Message to display on error.
1973
+ */
1974
+ doesNotHaveAnyDeepKeys<T>(
1975
+ object: T,
1976
+ keys: Array<Object | string> | { [key: string]: any },
1977
+ message?: string,
1978
+ ): void;
1979
+
1980
+ /**
1981
+ * Asserts that `object` contains all of the `keys` provided.
1982
+ * Since Sets and Maps can have objects as keys you can use this assertion to perform
1983
+ * a deep comparison.
1984
+ * You can also provide a single object instead of a `keys` array and its keys
1985
+ * will be used as the expected set of keys.
1986
+ *
1987
+ * T Type of object.
1988
+ * @param object Object to test.
1989
+ * @param keys Keys to check
1990
+ * @param message Message to display on error.
1991
+ */
1992
+ doesNotHaveAllDeepKeys<T>(
1993
+ object: T,
1994
+ keys: Array<Object | string> | { [key: string]: any },
1995
+ message?: string,
1996
+ ): void;
1997
+
1998
+ /**
1999
+ * Asserts that object has a direct or inherited property named by property,
2000
+ * which can be a string using dot- and bracket-notation for nested reference.
2001
+ *
2002
+ * T Type of object.
2003
+ * @param object Object to test.
2004
+ * @param property Property to test.
2005
+ * @param message Message to display on error.
2006
+ */
2007
+ nestedProperty<T>(object: T, property: string, message?: string): void;
2008
+
2009
+ /**
2010
+ * Asserts that object does not have a property named by property,
2011
+ * which can be a string using dot- and bracket-notation for nested reference.
2012
+ * The property cannot exist on the object nor anywhere in its prototype chain.
2013
+ *
2014
+ * T Type of object.
2015
+ * @param object Object to test.
2016
+ * @param property Property to test.
2017
+ * @param message Message to display on error.
2018
+ */
2019
+ notNestedProperty<T>(object: T, property: string, message?: string): void;
2020
+
2021
+ /**
2022
+ * Asserts that object has a property named by property with value given by value.
2023
+ * property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).
2024
+ *
2025
+ * T Type of object.
2026
+ * @param object Object to test.
2027
+ * @param property Property to test.
2028
+ * @param value Value to test.
2029
+ * @param message Message to display on error.
2030
+ */
2031
+ nestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void;
2032
+
2033
+ /**
2034
+ * Asserts that object does not have a property named by property with value given by value.
2035
+ * property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).
2036
+ *
2037
+ * T Type of object.
2038
+ * @param object Object to test.
2039
+ * @param property Property to test.
2040
+ * @param value Value to test.
2041
+ * @param message Message to display on error.
2042
+ */
2043
+ notNestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void;
2044
+
2045
+ /**
2046
+ * Asserts that object has a property named by property with a value given by value.
2047
+ * property can use dot- and bracket-notation for nested reference. Uses a deep equality check.
2048
+ *
2049
+ * T Type of object.
2050
+ * @param object Object to test.
2051
+ * @param property Property to test.
2052
+ * @param value Value to test.
2053
+ * @param message Message to display on error.
2054
+ */
2055
+ deepNestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void;
2056
+
2057
+ /**
2058
+ * Asserts that object does not have a property named by property with value given by value.
2059
+ * property can use dot- and bracket-notation for nested reference. Uses a deep equality check.
2060
+ *
2061
+ * T Type of object.
2062
+ * @param object Object to test.
2063
+ * @param property Property to test.
2064
+ * @param value Value to test.
2065
+ * @param message Message to display on error.
2066
+ */
2067
+ notDeepNestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void;
2068
+ }
2069
+
2070
+ export interface Config {
2071
+ /**
2072
+ * Default: false
2073
+ */
2074
+ includeStack: boolean;
2075
+
2076
+ /**
2077
+ * Default: true
2078
+ */
2079
+ showDiff: boolean;
2080
+
2081
+ /**
2082
+ * Default: 40
2083
+ */
2084
+ truncateThreshold: number;
2085
+
2086
+ /**
2087
+ * Default: true
2088
+ */
2089
+ useProxy: boolean;
2090
+
2091
+ /**
2092
+ * Default: ['then', 'catch', 'inspect', 'toJSON']
2093
+ */
2094
+ proxyExcludedKeys: string[];
2095
+
2096
+ deepEqual: <L, R>(expected: L, actual: R) => void;
2097
+ }
2098
+
2099
+ export class AssertionError {
2100
+ constructor(message: string, _props?: any, ssf?: Function);
2101
+ name: string;
2102
+ message: string;
2103
+ showDiff: boolean;
2104
+ stack: string;
2105
+ }
25
2106
  }
26
-
27
- interface ErrorConstructor {
28
- new(...args: any[]): Error;
29
- }
30
-
31
- interface ChaiUtils {
32
- addChainableMethod(
33
- // object to define the method on, e.g. chai.Assertion.prototype
34
- ctx: object,
35
- // method name
36
- name: string,
37
- // method itself; any arguments
38
- method: (...args: any[]) => void,
39
- // called when property is accessed
40
- chainingBehavior?: () => void,
41
- ): void;
42
- overwriteChainableMethod(
43
- ctx: object,
44
- name: string,
45
- method: (...args: any[]) => void,
46
- chainingBehavior?: () => void,
47
- ): void;
48
- addLengthGuard(
49
- fn: Function,
50
- assertionName: string,
51
- isChainable: boolean,
52
- ): void;
53
- addMethod(ctx: object, name: string, method: Function): void;
54
- addProperty(ctx: object, name: string, getter: () => any): void;
55
- overwriteMethod(ctx: object, name: string, method: Function): void;
56
- overwriteProperty(ctx: object, name: string, getter: () => any): void;
57
- compareByInspect(a: object, b: object): -1 | 1;
58
- expectTypes(obj: object, types: string[]): void;
59
- flag(obj: object, key: string, value?: any): any;
60
- getActual(obj: object, args: AssertionArgs): any;
61
- getProperties(obj: object): string[];
62
- getEnumerableProperties(obj: object): string[];
63
- getOwnEnumerablePropertySymbols(obj: object): symbol[];
64
- getOwnEnumerableProperties(obj: object): Array<string | symbol>;
65
- getMessage(errorLike: Error | string): string;
66
- getMessage(obj: any, args: AssertionArgs): string;
67
- inspect(obj: any, showHidden?: boolean, depth?: number, colors?: boolean): string;
68
- isProxyEnabled(): boolean;
69
- objDisplay(obj: object): void;
70
- proxify(obj: object, nonChainableMethodName: string): object;
71
- test(obj: object, args: AssertionArgs): boolean;
72
- transferFlags(assertion: Assertion, obj: object, includeAll?: boolean): void;
73
- compatibleInstance(thrown: Error, errorLike: Error | ErrorConstructor): boolean;
74
- compatibleConstructor(thrown: Error, errorLike: Error | ErrorConstructor): boolean;
75
- compatibleMessage(thrown: Error, errMatcher: string | RegExp): boolean;
76
- getConstructorName(constructorFn: Function): string;
77
- getFuncName(constructorFn: Function): string | null;
78
-
79
- // Reexports from pathval:
80
- hasProperty(obj: object | undefined | null, name: ObjectProperty): boolean;
81
- getPathInfo(obj: object, path: string): PathInfo;
82
- getPathValue(obj: object, path: string): object | undefined;
83
- }
84
-
85
- type ChaiPlugin = (chai: ChaiStatic, utils: ChaiUtils) => void;
86
-
87
- interface ChaiStatic {
88
- expect: ExpectStatic;
89
- should(): Should;
90
- /**
91
- * Provides a way to extend the internals of Chai
92
- */
93
- use(fn: ChaiPlugin): ChaiStatic;
94
- util: ChaiUtils;
95
- assert: AssertStatic;
96
- config: Config;
97
- Assertion: AssertionStatic;
98
- AssertionError: typeof AssertionError;
99
- version: string;
100
- }
101
-
102
- export interface ExpectStatic {
103
- (val: any, message?: string): Assertion;
104
- fail(message?: string): never;
105
- fail(actual: any, expected: any, message?: string, operator?: Operator): never;
106
- }
107
-
108
- export interface AssertStatic extends Assert {
109
- }
110
-
111
- // chai.Assertion.prototype.assert arguments
112
- type AssertionArgs = [
113
- // 'expression to be tested'
114
- // This parameter is unused and the docs list its type as
115
- // 'Philosophical', which is mentioned nowhere else in the source. Do
116
- // with that what you will!
117
- any,
118
- Message, // message if value fails
119
- Message, // message if negated value fails
120
- any, // expected value
121
- any?, // actual value
122
- boolean?, // showDiff
123
- ];
124
-
125
- export interface AssertionPrototype {
126
- assert(...args: AssertionArgs): void;
127
- _obj: any;
128
- }
129
-
130
- export interface AssertionStatic extends AssertionPrototype {
131
- prototype: AssertionPrototype;
132
-
133
- new(target: any, message?: string, ssfi?: Function, lockSsfi?: boolean): Assertion;
134
-
135
- // Deprecated properties:
136
- includeStack: boolean;
137
- showDiff: boolean;
138
-
139
- // Partials of functions on ChaiUtils:
140
- addProperty(name: string, getter: (this: AssertionStatic) => any): void;
141
- addMethod(name: string, method: (this: AssertionStatic, ...args: any[]) => any): void;
142
- addChainableMethod(
143
- name: string,
144
- method: (this: AssertionStatic, ...args: any[]) => void,
145
- chainingBehavior?: () => void,
146
- ): void;
147
- overwriteProperty(name: string, getter: (this: AssertionStatic) => any): void;
148
- overwriteMethod(name: string, method: (this: AssertionStatic, ...args: any[]) => any): void;
149
- overwriteChainableMethod(
150
- name: string,
151
- method: (this: AssertionStatic, ...args: any[]) => void,
152
- chainingBehavior?: () => void,
153
- ): void;
154
- }
155
-
156
- export type Operator = string; // "==" | "===" | ">" | ">=" | "<" | "<=" | "!=" | "!==";
157
-
158
- export type OperatorComparable = boolean | null | number | string | undefined | Date;
159
-
160
- interface ShouldAssertion {
161
- equal(value1: any, value2: any, message?: string): void;
162
- Throw: ShouldThrow;
163
- throw: ShouldThrow;
164
- exist(value: any, message?: string): void;
165
- }
166
-
167
- interface Should extends ShouldAssertion {
168
- not: ShouldAssertion;
169
- fail(message?: string): never;
170
- fail(actual: any, expected: any, message?: string, operator?: Operator): never;
171
- }
172
-
173
- interface ShouldThrow {
174
- (actual: Function, expected?: string | RegExp, message?: string): void;
175
- (actual: Function, constructor: Error | Function, expected?: string | RegExp, message?: string): void;
176
- }
177
-
178
- interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
179
- not: Assertion;
180
- deep: Deep;
181
- ordered: Ordered;
182
- nested: Nested;
183
- own: Own;
184
- any: KeyFilter;
185
- all: KeyFilter;
186
- a: Assertion;
187
- an: Assertion;
188
- include: Include;
189
- includes: Include;
190
- contain: Include;
191
- contains: Include;
192
- ok: Assertion;
193
- true: Assertion;
194
- false: Assertion;
195
- null: Assertion;
196
- undefined: Assertion;
197
- NaN: Assertion;
198
- exist: Assertion;
199
- empty: Assertion;
200
- arguments: Assertion;
201
- Arguments: Assertion;
202
- finite: Assertion;
203
- equal: Equal;
204
- equals: Equal;
205
- eq: Equal;
206
- eql: Equal;
207
- eqls: Equal;
208
- property: Property;
209
- ownProperty: Property;
210
- haveOwnProperty: Property;
211
- ownPropertyDescriptor: OwnPropertyDescriptor;
212
- haveOwnPropertyDescriptor: OwnPropertyDescriptor;
213
- length: Length;
214
- lengthOf: Length;
215
- match: Match;
216
- matches: Match;
217
- string(string: string, message?: string): Assertion;
218
- keys: Keys;
219
- key(string: string): Assertion;
220
- throw: Throw;
221
- throws: Throw;
222
- Throw: Throw;
223
- respondTo: RespondTo;
224
- respondsTo: RespondTo;
225
- itself: Assertion;
226
- satisfy: Satisfy;
227
- satisfies: Satisfy;
228
- closeTo: CloseTo;
229
- approximately: CloseTo;
230
- members: Members;
231
- increase: PropertyChange;
232
- increases: PropertyChange;
233
- decrease: PropertyChange;
234
- decreases: PropertyChange;
235
- change: PropertyChange;
236
- changes: PropertyChange;
237
- extensible: Assertion;
238
- sealed: Assertion;
239
- frozen: Assertion;
240
- oneOf: OneOf;
241
- }
242
-
243
- interface LanguageChains {
244
- to: Assertion;
245
- be: Assertion;
246
- been: Assertion;
247
- is: Assertion;
248
- that: Assertion;
249
- which: Assertion;
250
- and: Assertion;
251
- has: Assertion;
252
- have: Assertion;
253
- with: Assertion;
254
- at: Assertion;
255
- of: Assertion;
256
- same: Assertion;
257
- but: Assertion;
258
- does: Assertion;
259
- }
260
-
261
- interface NumericComparison {
262
- above: NumberComparer;
263
- gt: NumberComparer;
264
- greaterThan: NumberComparer;
265
- least: NumberComparer;
266
- gte: NumberComparer;
267
- greaterThanOrEqual: NumberComparer;
268
- below: NumberComparer;
269
- lt: NumberComparer;
270
- lessThan: NumberComparer;
271
- most: NumberComparer;
272
- lte: NumberComparer;
273
- lessThanOrEqual: NumberComparer;
274
- within(start: number, finish: number, message?: string): Assertion;
275
- within(start: Date, finish: Date, message?: string): Assertion;
276
- }
277
-
278
- interface NumberComparer {
279
- (value: number | Date, message?: string): Assertion;
280
- }
281
-
282
- interface TypeComparison {
283
- (type: string, message?: string): Assertion;
284
- instanceof: InstanceOf;
285
- instanceOf: InstanceOf;
286
- }
287
-
288
- interface InstanceOf {
289
- (constructor: any, message?: string): Assertion;
290
- }
291
-
292
- interface CloseTo {
293
- (expected: number, delta: number, message?: string): Assertion;
294
- }
295
-
296
- interface Nested {
297
- include: Include;
298
- includes: Include;
299
- contain: Include;
300
- contains: Include;
301
- property: Property;
302
- members: Members;
303
- }
304
-
305
- interface Own {
306
- include: Include;
307
- includes: Include;
308
- contain: Include;
309
- contains: Include;
310
- property: Property;
311
- }
312
-
313
- interface Deep extends KeyFilter {
314
- be: Assertion;
315
- equal: Equal;
316
- equals: Equal;
317
- eq: Equal;
318
- include: Include;
319
- includes: Include;
320
- contain: Include;
321
- contains: Include;
322
- property: Property;
323
- ordered: Ordered;
324
- nested: Nested;
325
- oneOf: OneOf;
326
- own: Own;
327
- }
328
-
329
- interface Ordered {
330
- members: Members;
331
- }
332
-
333
- interface KeyFilter {
334
- keys: Keys;
335
- members: Members;
336
- }
337
-
338
- interface Equal {
339
- (value: any, message?: string): Assertion;
340
- }
341
-
342
- interface Property {
343
- (name: string | symbol, value: any, message?: string): Assertion;
344
- (name: string | symbol, message?: string): Assertion;
345
- }
346
-
347
- interface OwnPropertyDescriptor {
348
- (name: string | symbol, descriptor: PropertyDescriptor, message?: string): Assertion;
349
- (name: string | symbol, message?: string): Assertion;
350
- }
351
-
352
- interface Length extends LanguageChains, NumericComparison {
353
- (length: number, message?: string): Assertion;
354
- }
355
-
356
- interface Include {
357
- (value: any, message?: string): Assertion;
358
- keys: Keys;
359
- deep: Deep;
360
- ordered: Ordered;
361
- members: Members;
362
- any: KeyFilter;
363
- all: KeyFilter;
364
- oneOf: OneOf;
365
- }
366
-
367
- interface OneOf {
368
- (list: ReadonlyArray<unknown>, message?: string): Assertion;
369
- }
370
-
371
- interface Match {
372
- (regexp: RegExp, message?: string): Assertion;
373
- }
374
-
375
- interface Keys {
376
- (...keys: string[]): Assertion;
377
- (keys: ReadonlyArray<any> | Object): Assertion;
378
- }
379
-
380
- interface Throw {
381
- (expected?: string | RegExp, message?: string): Assertion;
382
- (constructor: Error | Function, expected?: string | RegExp, message?: string): Assertion;
383
- }
384
-
385
- interface RespondTo {
386
- (method: string, message?: string): Assertion;
387
- }
388
-
389
- interface Satisfy {
390
- (matcher: Function, message?: string): Assertion;
391
- }
392
-
393
- interface Members {
394
- (set: ReadonlyArray<any>, message?: string): Assertion;
395
- }
396
-
397
- interface PropertyChange {
398
- (object: Object, property?: string, message?: string): DeltaAssertion;
399
- }
400
-
401
- interface DeltaAssertion extends Assertion {
402
- by(delta: number, msg?: string): Assertion;
403
- }
404
-
405
- export interface Assert {
406
- /**
407
- * @param expression Expression to test for truthiness.
408
- * @param message Message to display on error.
409
- */
410
- (expression: any, message?: string): asserts expression;
411
-
412
- /**
413
- * Throws a failure.
414
- *
415
- * @param message Message to display on error.
416
- * @remarks Node.js assert module-compatible.
417
- */
418
- fail(message?: string): never;
419
-
420
- /**
421
- * Throws a failure.
422
- *
423
- * T Type of the objects.
424
- * @param actual Actual value.
425
- * @param expected Potential expected value.
426
- * @param message Message to display on error.
427
- * @param operator Comparison operator, if not strict equality.
428
- * @remarks Node.js assert module-compatible.
429
- */
430
- fail<T>(actual: T, expected: T, message?: string, operator?: Operator): never;
431
-
432
- /**
433
- * Asserts that object is truthy.
434
- *
435
- * T Type of object.
436
- * @param object Object to test.
437
- * @param message Message to display on error.
438
- */
439
- isOk<T>(value: T, message?: string): void;
440
-
441
- /**
442
- * Asserts that object is truthy.
443
- *
444
- * T Type of object.
445
- * @param object Object to test.
446
- * @param message Message to display on error.
447
- */
448
- ok<T>(value: T, message?: string): void;
449
-
450
- /**
451
- * Asserts that object is falsy.
452
- *
453
- * T Type of object.
454
- * @param object Object to test.
455
- * @param message Message to display on error.
456
- */
457
- isNotOk<T>(value: T, message?: string): void;
458
-
459
- /**
460
- * Asserts that object is falsy.
461
- *
462
- * T Type of object.
463
- * @param object Object to test.
464
- * @param message Message to display on error.
465
- */
466
- notOk<T>(value: T, message?: string): void;
467
-
468
- /**
469
- * Asserts non-strict equality (==) of actual and expected.
470
- *
471
- * T Type of the objects.
472
- * @param actual Actual value.
473
- * @param expected Potential expected value.
474
- * @param message Message to display on error.
475
- */
476
- equal<T>(actual: T, expected: T, message?: string): void;
477
-
478
- /**
479
- * Asserts non-strict inequality (!=) of actual and expected.
480
- *
481
- * T Type of the objects.
482
- * @param actual Actual value.
483
- * @param expected Potential expected value.
484
- * @param message Message to display on error.
485
- */
486
- notEqual<T>(actual: T, expected: T, message?: string): void;
487
-
488
- /**
489
- * Asserts strict equality (===) of actual and expected.
490
- *
491
- * T Type of the objects.
492
- * @param actual Actual value.
493
- * @param expected Potential expected value.
494
- * @param message Message to display on error.
495
- */
496
- strictEqual<T>(actual: T, expected: T, message?: string): void;
497
-
498
- /**
499
- * Asserts strict inequality (!==) of actual and expected.
500
- *
501
- * T Type of the objects.
502
- * @param actual Actual value.
503
- * @param expected Potential expected value.
504
- * @param message Message to display on error.
505
- */
506
- notStrictEqual<T>(actual: T, expected: T, message?: string): void;
507
-
508
- /**
509
- * Asserts that actual is deeply equal to expected.
510
- *
511
- * T Type of the objects.
512
- * @param actual Actual value.
513
- * @param expected Potential expected value.
514
- * @param message Message to display on error.
515
- */
516
- deepEqual<T>(actual: T, expected: T, message?: string): void;
517
-
518
- /**
519
- * Asserts that actual is not deeply equal to expected.
520
- *
521
- * T Type of the objects.
522
- * @param actual Actual value.
523
- * @param expected Potential expected value.
524
- * @param message Message to display on error.
525
- */
526
- notDeepEqual<T>(actual: T, expected: T, message?: string): void;
527
-
528
- /**
529
- * Alias to deepEqual
530
- *
531
- * T Type of the objects.
532
- * @param actual Actual value.
533
- * @param expected Potential expected value.
534
- * @param message Message to display on error.
535
- */
536
- deepStrictEqual<T>(actual: T, expected: T, message?: string): void;
537
-
538
- /**
539
- * Asserts valueToCheck is strictly greater than (>) valueToBeAbove.
540
- *
541
- * @param valueToCheck Actual value.
542
- * @param valueToBeAbove Minimum Potential expected value.
543
- * @param message Message to display on error.
544
- */
545
- isAbove(valueToCheck: number, valueToBeAbove: number, message?: string): void;
546
-
547
- /**
548
- * Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast.
549
- *
550
- * @param valueToCheck Actual value.
551
- * @param valueToBeAtLeast Minimum Potential expected value.
552
- * @param message Message to display on error.
553
- */
554
- isAtLeast(valueToCheck: number, valueToBeAtLeast: number, message?: string): void;
555
-
556
- /**
557
- * Asserts valueToCheck is strictly less than (<) valueToBeBelow.
558
- *
559
- * @param valueToCheck Actual value.
560
- * @param valueToBeBelow Minimum Potential expected value.
561
- * @param message Message to display on error.
562
- */
563
- isBelow(valueToCheck: number, valueToBeBelow: number, message?: string): void;
564
-
565
- /**
566
- * Asserts valueToCheck is less than or equal to (<=) valueToBeAtMost.
567
- *
568
- * @param valueToCheck Actual value.
569
- * @param valueToBeAtMost Minimum Potential expected value.
570
- * @param message Message to display on error.
571
- */
572
- isAtMost(valueToCheck: number, valueToBeAtMost: number, message?: string): void;
573
-
574
- /**
575
- * Asserts that value is true.
576
- *
577
- * T Type of value.
578
- * @param value Actual value.
579
- * @param message Message to display on error.
580
- */
581
- isTrue<T>(value: T, message?: string): void;
582
-
583
- /**
584
- * Asserts that value is false.
585
- *
586
- * T Type of value.
587
- * @param value Actual value.
588
- * @param message Message to display on error.
589
- */
590
- isFalse<T>(value: T, message?: string): void;
591
-
592
- /**
593
- * Asserts that value is not true.
594
- *
595
- * T Type of value.
596
- * @param value Actual value.
597
- * @param message Message to display on error.
598
- */
599
- isNotTrue<T>(value: T, message?: string): void;
600
-
601
- /**
602
- * Asserts that value is not false.
603
- *
604
- * T Type of value.
605
- * @param value Actual value.
606
- * @param message Message to display on error.
607
- */
608
- isNotFalse<T>(value: T, message?: string): void;
609
-
610
- /**
611
- * Asserts that value is null.
612
- *
613
- * T Type of value.
614
- * @param value Actual value.
615
- * @param message Message to display on error.
616
- */
617
- isNull<T>(value: T, message?: string): void;
618
-
619
- /**
620
- * Asserts that value is not null.
621
- *
622
- * T Type of value.
623
- * @param value Actual value.
624
- * @param message Message to display on error.
625
- */
626
- isNotNull<T>(value: T, message?: string): void;
627
-
628
- /**
629
- * Asserts that value is NaN.
630
- *
631
- * T Type of value.
632
- * @param value Actual value.
633
- * @param message Message to display on error.
634
- */
635
- isNaN<T>(value: T, message?: string): void;
636
-
637
- /**
638
- * Asserts that value is not NaN.
639
- *
640
- * T Type of value.
641
- * @param value Actual value.
642
- * @param message Message to display on error.
643
- */
644
- isNotNaN<T>(value: T, message?: string): void;
645
-
646
- /**
647
- * Asserts that the target is neither null nor undefined.
648
- *
649
- * T Type of value.
650
- * @param value Actual value.
651
- * @param message Message to display on error.
652
- */
653
- exists<T>(value: T, message?: string): void;
654
-
655
- /**
656
- * Asserts that the target is either null or undefined.
657
- *
658
- * T Type of value.
659
- * @param value Actual value.
660
- * @param message Message to display on error.
661
- */
662
- notExists<T>(value: T, message?: string): void;
663
-
664
- /**
665
- * Asserts that value is undefined.
666
- *
667
- * T Type of value.
668
- * @param value Actual value.
669
- * @param message Message to display on error.
670
- */
671
- isUndefined<T>(value: T, message?: string): void;
672
-
673
- /**
674
- * Asserts that value is not undefined.
675
- *
676
- * T Type of value.
677
- * @param value Actual value.
678
- * @param message Message to display on error.
679
- */
680
- isDefined<T>(value: T, message?: string): void;
681
-
682
- /**
683
- * Asserts that value is a function.
684
- *
685
- * T Type of value.
686
- * @param value Actual value.
687
- * @param message Message to display on error.
688
- */
689
- isFunction<T>(value: T, message?: string): void;
690
-
691
- /**
692
- * Asserts that value is not a function.
693
- *
694
- * T Type of value.
695
- * @param value Actual value.
696
- * @param message Message to display on error.
697
- */
698
- isNotFunction<T>(value: T, message?: string): void;
699
-
700
- /**
701
- * Asserts that value is an object of type 'Object'
702
- * (as revealed by Object.prototype.toString).
703
- *
704
- * T Type of value.
705
- * @param value Actual value.
706
- * @param message Message to display on error.
707
- * @remarks The assertion does not match subclassed objects.
708
- */
709
- isObject<T>(value: T, message?: string): void;
710
-
711
- /**
712
- * Asserts that value is not an object of type 'Object'
713
- * (as revealed by Object.prototype.toString).
714
- *
715
- * T Type of value.
716
- * @param value Actual value.
717
- * @param message Message to display on error.
718
- */
719
- isNotObject<T>(value: T, message?: string): void;
720
-
721
- /**
722
- * Asserts that value is an array.
723
- *
724
- * T Type of value.
725
- * @param value Actual value.
726
- * @param message Message to display on error.
727
- */
728
- isArray<T>(value: T, message?: string): void;
729
-
730
- /**
731
- * Asserts that value is not an array.
732
- *
733
- * T Type of value.
734
- * @param value Actual value.
735
- * @param message Message to display on error.
736
- */
737
- isNotArray<T>(value: T, message?: string): void;
738
-
739
- /**
740
- * Asserts that value is a string.
741
- *
742
- * T Type of value.
743
- * @param value Actual value.
744
- * @param message Message to display on error.
745
- */
746
- isString<T>(value: T, message?: string): void;
747
-
748
- /**
749
- * Asserts that value is not a string.
750
- *
751
- * T Type of value.
752
- * @param value Actual value.
753
- * @param message Message to display on error.
754
- */
755
- isNotString<T>(value: T, message?: string): void;
756
-
757
- /**
758
- * Asserts that value is a number.
759
- *
760
- * T Type of value.
761
- * @param value Actual value.
762
- * @param message Message to display on error.
763
- */
764
- isNumber<T>(value: T, message?: string): void;
765
-
766
- /**
767
- * Asserts that value is not a number.
768
- *
769
- * T Type of value.
770
- * @param value Actual value.
771
- * @param message Message to display on error.
772
- */
773
- isNotNumber<T>(value: T, message?: string): void;
774
-
775
- /**
776
- * Asserts that value is a finite number.
777
- * Unlike `.isNumber`, this will fail for `NaN` and `Infinity`.
778
- *
779
- * T Type of value
780
- * @param value Actual value
781
- * @param message Message to display on error.
782
- */
783
- isFinite<T>(value: T, message?: string): void;
784
-
785
- /**
786
- * Asserts that value is a boolean.
787
- *
788
- * T Type of value.
789
- * @param value Actual value.
790
- * @param message Message to display on error.
791
- */
792
- isBoolean<T>(value: T, message?: string): void;
793
-
794
- /**
795
- * Asserts that value is not a boolean.
796
- *
797
- * T Type of value.
798
- * @param value Actual value.
799
- * @param message Message to display on error.
800
- */
801
- isNotBoolean<T>(value: T, message?: string): void;
802
-
803
- /**
804
- * Asserts that value's type is name, as determined by Object.prototype.toString.
805
- *
806
- * T Type of value.
807
- * @param value Actual value.
808
- * @param name Potential expected type name of value.
809
- * @param message Message to display on error.
810
- */
811
- typeOf<T>(value: T, name: string, message?: string): void;
812
-
813
- /**
814
- * Asserts that value's type is not name, as determined by Object.prototype.toString.
815
- *
816
- * T Type of value.
817
- * @param value Actual value.
818
- * @param name Potential expected type name of value.
819
- * @param message Message to display on error.
820
- */
821
- notTypeOf<T>(value: T, name: string, message?: string): void;
822
-
823
- /**
824
- * Asserts that value is an instance of constructor.
825
- *
826
- * T Type of value.
827
- * @param value Actual value.
828
- * @param constructor Potential expected contructor of value.
829
- * @param message Message to display on error.
830
- */
831
- instanceOf<T>(value: T, constructor: Function, message?: string): void;
832
-
833
- /**
834
- * Asserts that value is not an instance of constructor.
835
- *
836
- * T Type of value.
837
- * @param value Actual value.
838
- * @param constructor Potential expected contructor of value.
839
- * @param message Message to display on error.
840
- */
841
- notInstanceOf<T>(value: T, type: Function, message?: string): void;
842
-
843
- /**
844
- * Asserts that haystack includes needle.
845
- *
846
- * @param haystack Container string.
847
- * @param needle Potential substring of haystack.
848
- * @param message Message to display on error.
849
- */
850
- include(haystack: string, needle: string, message?: string): void;
851
-
852
- /**
853
- * Asserts that haystack includes needle.
854
- *
855
- * T Type of values in haystack.
856
- * @param haystack Container array, set or map.
857
- * @param needle Potential value contained in haystack.
858
- * @param message Message to display on error.
859
- */
860
- include<T>(
861
- haystack: ReadonlyArray<T> | ReadonlySet<T> | ReadonlyMap<any, T>,
862
- needle: T,
863
- message?: string,
864
- ): void;
865
-
866
- /**
867
- * Asserts that haystack includes needle.
868
- *
869
- * T Type of values in haystack.
870
- * @param haystack WeakSet container.
871
- * @param needle Potential value contained in haystack.
872
- * @param message Message to display on error.
873
- */
874
- include<T extends object>(haystack: WeakSet<T>, needle: T, message?: string): void;
875
-
876
- /**
877
- * Asserts that haystack includes needle.
878
- *
879
- * T Type of haystack.
880
- * @param haystack Object.
881
- * @param needle Potential subset of the haystack's properties.
882
- * @param message Message to display on error.
883
- */
884
- include<T>(haystack: T, needle: Partial<T>, message?: string): void;
885
-
886
- /**
887
- * Asserts that haystack does not includes needle.
888
- *
889
- * @param haystack Container string.
890
- * @param needle Potential substring of haystack.
891
- * @param message Message to display on error.
892
- */
893
- notInclude(haystack: string, needle: string, message?: string): void;
894
-
895
- /**
896
- * Asserts that haystack does not includes needle.
897
- *
898
- * T Type of values in haystack.
899
- * @param haystack Container array, set or map.
900
- * @param needle Potential value contained in haystack.
901
- * @param message Message to display on error.
902
- */
903
- notInclude<T>(
904
- haystack: ReadonlyArray<T> | ReadonlySet<T> | ReadonlyMap<any, T>,
905
- needle: T,
906
- message?: string,
907
- ): void;
908
-
909
- /**
910
- * Asserts that haystack does not includes needle.
911
- *
912
- * T Type of values in haystack.
913
- * @param haystack WeakSet container.
914
- * @param needle Potential value contained in haystack.
915
- * @param message Message to display on error.
916
- */
917
- notInclude<T extends object>(haystack: WeakSet<T>, needle: T, message?: string): void;
918
-
919
- /**
920
- * Asserts that haystack does not includes needle.
921
- *
922
- * T Type of haystack.
923
- * @param haystack Object.
924
- * @param needle Potential subset of the haystack's properties.
925
- * @param message Message to display on error.
926
- */
927
- notInclude<T>(haystack: T, needle: Partial<T>, message?: string): void;
928
-
929
- /**
930
- * Asserts that haystack includes needle. Deep equality is used.
931
- *
932
- * @param haystack Container string.
933
- * @param needle Potential substring of haystack.
934
- * @param message Message to display on error.
935
- *
936
- * @deprecated Does not have any effect on string. Use {@link Assert#include} instead.
937
- */
938
- deepInclude(haystack: string, needle: string, message?: string): void;
939
-
940
- /**
941
- * Asserts that haystack includes needle. Deep equality is used.
942
- *
943
- * T Type of values in haystack.
944
- * @param haystack Container array, set or map.
945
- * @param needle Potential value contained in haystack.
946
- * @param message Message to display on error.
947
- */
948
- deepInclude<T>(
949
- haystack: ReadonlyArray<T> | ReadonlySet<T> | ReadonlyMap<any, T>,
950
- needle: T,
951
- message?: string,
952
- ): void;
953
-
954
- /**
955
- * Asserts that haystack does not includes needle.
956
- *
957
- * T Type of haystack.
958
- * @param haystack Object.
959
- * @param needle Potential subset of the haystack's properties.
960
- * @param message Message to display on error.
961
- */
962
- deepInclude<T>(haystack: T, needle: T extends WeakSet<any> ? never : Partial<T>, message?: string): void;
963
-
964
- /**
965
- * Asserts that haystack does not includes needle. Deep equality is used.
966
- *
967
- * @param haystack Container string.
968
- * @param needle Potential substring of haystack.
969
- * @param message Message to display on error.
970
- *
971
- * @deprecated Does not have any effect on string. Use {@link Assert#notInclude} instead.
972
- */
973
- notDeepInclude(haystack: string, needle: string, message?: string): void;
974
-
975
- /**
976
- * Asserts that haystack does not includes needle. Deep equality is used.
977
- *
978
- * T Type of values in haystack.
979
- * @param haystack Container array, set or map.
980
- * @param needle Potential value contained in haystack.
981
- * @param message Message to display on error.
982
- */
983
- notDeepInclude<T>(
984
- haystack: ReadonlyArray<T> | ReadonlySet<T> | ReadonlyMap<any, T>,
985
- needle: T,
986
- message?: string,
987
- ): void;
988
-
989
- /**
990
- * Asserts that haystack does not includes needle. Deep equality is used.
991
- *
992
- * T Type of haystack.
993
- * @param haystack Object.
994
- * @param needle Potential subset of the haystack's properties.
995
- * @param message Message to display on error.
996
- */
997
- notDeepInclude<T>(haystack: T, needle: T extends WeakSet<any> ? never : Partial<T>, message?: string): void;
998
-
999
- /**
1000
- * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object.
1001
- *
1002
- * Enables the use of dot- and bracket-notation for referencing nested properties.
1003
- * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
1004
- * Can be used to assert the inclusion of a subset of properties in an object.
1005
- * Enables the use of dot- and bracket-notation for referencing nested properties.
1006
- * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
1007
- *
1008
- * @param haystack
1009
- * @param needle
1010
- * @param message Message to display on error.
1011
- */
1012
- nestedInclude(haystack: any, needle: any, message?: string): void;
1013
-
1014
- /**
1015
- * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object.
1016
- *
1017
- * Enables the use of dot- and bracket-notation for referencing nested properties.
1018
- * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
1019
- * Can be used to assert the inclusion of a subset of properties in an object.
1020
- * Enables the use of dot- and bracket-notation for referencing nested properties.
1021
- * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
1022
- *
1023
- * @param haystack
1024
- * @param needle
1025
- * @param message Message to display on error.
1026
- */
1027
- notNestedInclude(haystack: any, needle: any, message?: string): void;
1028
-
1029
- /**
1030
- * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while checking for deep equality
1031
- *
1032
- * Enables the use of dot- and bracket-notation for referencing nested properties.
1033
- * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
1034
- * Can be used to assert the inclusion of a subset of properties in an object.
1035
- * Enables the use of dot- and bracket-notation for referencing nested properties.
1036
- * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
1037
- *
1038
- * @param haystack
1039
- * @param needle
1040
- * @param message Message to display on error.
1041
- */
1042
- deepNestedInclude(haystack: any, needle: any, message?: string): void;
1043
-
1044
- /**
1045
- * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object while checking for deep equality.
1046
- *
1047
- * Enables the use of dot- and bracket-notation for referencing nested properties.
1048
- * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
1049
- * Can be used to assert the inclusion of a subset of properties in an object.
1050
- * Enables the use of dot- and bracket-notation for referencing nested properties.
1051
- * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
1052
- *
1053
- * @param haystack
1054
- * @param needle
1055
- * @param message Message to display on error.
1056
- */
1057
- notDeepNestedInclude(haystack: any, needle: any, message?: string): void;
1058
-
1059
- /**
1060
- * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties.
1061
- *
1062
- * @param haystack
1063
- * @param needle
1064
- * @param message Message to display on error.
1065
- */
1066
- ownInclude(haystack: any, needle: any, message?: string): void;
1067
-
1068
- /**
1069
- * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties.
1070
- *
1071
- * @param haystack
1072
- * @param needle
1073
- * @param message Message to display on error.
1074
- */
1075
- notOwnInclude(haystack: any, needle: any, message?: string): void;
1076
-
1077
- /**
1078
- * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties and checking for deep
1079
- *
1080
- * @param haystack
1081
- * @param needle
1082
- * @param message Message to display on error.
1083
- */
1084
- deepOwnInclude(haystack: any, needle: any, message?: string): void;
1085
-
1086
- /**
1087
- * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties and checking for deep equality.
1088
- *
1089
- * @param haystack
1090
- * @param needle
1091
- * @param message Message to display on error.
1092
- */
1093
- notDeepOwnInclude(haystack: any, needle: any, message?: string): void;
1094
-
1095
- /**
1096
- * Asserts that value matches the regular expression regexp.
1097
- *
1098
- * @param value Actual value.
1099
- * @param regexp Potential match of value.
1100
- * @param message Message to display on error.
1101
- */
1102
- match(value: string, regexp: RegExp, message?: string): void;
1103
-
1104
- /**
1105
- * Asserts that value does not match the regular expression regexp.
1106
- *
1107
- * @param value Actual value.
1108
- * @param regexp Potential match of value.
1109
- * @param message Message to display on error.
1110
- */
1111
- notMatch(expected: any, regexp: RegExp, message?: string): void;
1112
-
1113
- /**
1114
- * Asserts that object has a property named by property.
1115
- *
1116
- * T Type of object.
1117
- * @param object Container object.
1118
- * @param property Potential contained property of object.
1119
- * @param message Message to display on error.
1120
- */
1121
- property<T>(object: T, property: string, /* keyof T */ message?: string): void;
1122
-
1123
- /**
1124
- * Asserts that object has a property named by property.
1125
- *
1126
- * T Type of object.
1127
- * @param object Container object.
1128
- * @param property Potential contained property of object.
1129
- * @param message Message to display on error.
1130
- */
1131
- notProperty<T>(object: T, property: string, /* keyof T */ message?: string): void;
1132
-
1133
- /**
1134
- * Asserts that object has a property named by property, which can be a string
1135
- * using dot- and bracket-notation for deep reference.
1136
- *
1137
- * T Type of object.
1138
- * @param object Container object.
1139
- * @param property Potential contained property of object.
1140
- * @param message Message to display on error.
1141
- */
1142
- deepProperty<T>(object: T, property: string, message?: string): void;
1143
-
1144
- /**
1145
- * Asserts that object does not have a property named by property, which can be a
1146
- * string using dot- and bracket-notation for deep reference.
1147
- *
1148
- * T Type of object.
1149
- * @param object Container object.
1150
- * @param property Potential contained property of object.
1151
- * @param message Message to display on error.
1152
- */
1153
- notDeepProperty<T>(object: T, property: string, message?: string): void;
1154
-
1155
- /**
1156
- * Asserts that object has a property named by property with value given by value.
1157
- *
1158
- * T Type of object.
1159
- * V Type of value.
1160
- * @param object Container object.
1161
- * @param property Potential contained property of object.
1162
- * @param value Potential expected property value.
1163
- * @param message Message to display on error.
1164
- */
1165
- propertyVal<T, V>(object: T, property: string, /* keyof T */ value: V, message?: string): void;
1166
-
1167
- /**
1168
- * Asserts that object has a property named by property with value given by value.
1169
- *
1170
- * T Type of object.
1171
- * V Type of value.
1172
- * @param object Container object.
1173
- * @param property Potential contained property of object.
1174
- * @param value Potential expected property value.
1175
- * @param message Message to display on error.
1176
- */
1177
- notPropertyVal<T, V>(object: T, property: string, /* keyof T */ value: V, message?: string): void;
1178
-
1179
- /**
1180
- * Asserts that object has a property named by property, which can be a string
1181
- * using dot- and bracket-notation for deep reference.
1182
- *
1183
- * T Type of object.
1184
- * V Type of value.
1185
- * @param object Container object.
1186
- * @param property Potential contained property of object.
1187
- * @param value Potential expected property value.
1188
- * @param message Message to display on error.
1189
- */
1190
- deepPropertyVal<T, V>(object: T, property: string, value: V, message?: string): void;
1191
-
1192
- /**
1193
- * Asserts that object does not have a property named by property, which can be a
1194
- * string using dot- and bracket-notation for deep reference.
1195
- *
1196
- * T Type of object.
1197
- * V Type of value.
1198
- * @param object Container object.
1199
- * @param property Potential contained property of object.
1200
- * @param value Potential expected property value.
1201
- * @param message Message to display on error.
1202
- */
1203
- notDeepPropertyVal<T, V>(object: T, property: string, value: V, message?: string): void;
1204
-
1205
- /**
1206
- * Asserts that object has a length property with the expected value.
1207
- *
1208
- * T Type of object.
1209
- * @param object Container object.
1210
- * @param length Potential expected length of object.
1211
- * @param message Message to display on error.
1212
- */
1213
- lengthOf<T extends { readonly length?: number | undefined }>(object: T, length: number, message?: string): void;
1214
-
1215
- /**
1216
- * Asserts that fn will throw an error.
1217
- *
1218
- * @param fn Function that may throw.
1219
- * @param errMsgMatcher Expected error message matcher.
1220
- * @param ignored Ignored parameter.
1221
- * @param message Message to display on error.
1222
- */
1223
- throw(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void;
1224
-
1225
- /**
1226
- * Asserts that fn will throw an error.
1227
- *
1228
- * @param fn Function that may throw.
1229
- * @param errorLike Expected error constructor or error instance.
1230
- * @param errMsgMatcher Expected error message matcher.
1231
- * @param message Message to display on error.
1232
- */
1233
- throw(
1234
- fn: () => void,
1235
- errorLike?: ErrorConstructor | Error | null,
1236
- errMsgMatcher?: RegExp | string | null,
1237
- message?: string,
1238
- ): void;
1239
-
1240
- /**
1241
- * Asserts that fn will throw an error.
1242
- *
1243
- * @param fn Function that may throw.
1244
- * @param errMsgMatcher Expected error message matcher.
1245
- * @param ignored Ignored parameter.
1246
- * @param message Message to display on error.
1247
- */
1248
- throws(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void;
1249
-
1250
- /**
1251
- * Asserts that fn will throw an error.
1252
- *
1253
- * @param fn Function that may throw.
1254
- * @param errorLike Expected error constructor or error instance.
1255
- * @param errMsgMatcher Expected error message matcher.
1256
- * @param message Message to display on error.
1257
- */
1258
- throws(
1259
- fn: () => void,
1260
- errorLike?: ErrorConstructor | Error | null,
1261
- errMsgMatcher?: RegExp | string | null,
1262
- message?: string,
1263
- ): void;
1264
-
1265
- /**
1266
- * Asserts that fn will throw an error.
1267
- *
1268
- * @param fn Function that may throw.
1269
- * @param errMsgMatcher Expected error message matcher.
1270
- * @param ignored Ignored parameter.
1271
- * @param message Message to display on error.
1272
- */
1273
- Throw(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void;
1274
-
1275
- /**
1276
- * Asserts that fn will throw an error.
1277
- *
1278
- * @param fn Function that may throw.
1279
- * @param errorLike Expected error constructor or error instance.
1280
- * @param errMsgMatcher Expected error message matcher.
1281
- * @param message Message to display on error.
1282
- */
1283
- Throw(
1284
- fn: () => void,
1285
- errorLike?: ErrorConstructor | Error | null,
1286
- errMsgMatcher?: RegExp | string | null,
1287
- message?: string,
1288
- ): void;
1289
-
1290
- /**
1291
- * Asserts that fn will not throw an error.
1292
- *
1293
- * @param fn Function that may throw.
1294
- * @param errMsgMatcher Expected error message matcher.
1295
- * @param ignored Ignored parameter.
1296
- * @param message Message to display on error.
1297
- */
1298
- doesNotThrow(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void;
1299
-
1300
- /**
1301
- * Asserts that fn will not throw an error.
1302
- *
1303
- * @param fn Function that may throw.
1304
- * @param errorLike Expected error constructor or error instance.
1305
- * @param errMsgMatcher Expected error message matcher.
1306
- * @param message Message to display on error.
1307
- */
1308
- doesNotThrow(
1309
- fn: () => void,
1310
- errorLike?: ErrorConstructor | Error | null,
1311
- errMsgMatcher?: RegExp | string | null,
1312
- message?: string,
1313
- ): void;
1314
-
1315
- /**
1316
- * Compares two values using operator.
1317
- *
1318
- * @param val1 Left value during comparison.
1319
- * @param operator Comparison operator.
1320
- * @param val2 Right value during comparison.
1321
- * @param message Message to display on error.
1322
- */
1323
- operator(val1: OperatorComparable, operator: Operator, val2: OperatorComparable, message?: string): void;
1324
-
1325
- /**
1326
- * Asserts that the target is equal to expected, to within a +/- delta range.
1327
- *
1328
- * @param actual Actual value
1329
- * @param expected Potential expected value.
1330
- * @param delta Maximum differenced between values.
1331
- * @param message Message to display on error.
1332
- */
1333
- closeTo(actual: number, expected: number, delta: number, message?: string): void;
1334
-
1335
- /**
1336
- * Asserts that the target is equal to expected, to within a +/- delta range.
1337
- *
1338
- * @param actual Actual value
1339
- * @param expected Potential expected value.
1340
- * @param delta Maximum differenced between values.
1341
- * @param message Message to display on error.
1342
- */
1343
- approximately(act: number, exp: number, delta: number, message?: string): void;
1344
-
1345
- /**
1346
- * Asserts that set1 and set2 have the same members. Order is not take into account.
1347
- *
1348
- * T Type of set values.
1349
- * @param set1 Actual set of values.
1350
- * @param set2 Potential expected set of values.
1351
- * @param message Message to display on error.
1352
- */
1353
- sameMembers<T>(set1: T[], set2: T[], message?: string): void;
1354
-
1355
- /**
1356
- * Asserts that set1 and set2 have the same members using deep equality checking.
1357
- * Order is not take into account.
1358
- *
1359
- * T Type of set values.
1360
- * @param set1 Actual set of values.
1361
- * @param set2 Potential expected set of values.
1362
- * @param message Message to display on error.
1363
- */
1364
- sameDeepMembers<T>(set1: T[], set2: T[], message?: string): void;
1365
-
1366
- /**
1367
- * Asserts that set1 and set2 have the same members in the same order.
1368
- * Uses a strict equality check (===).
1369
- *
1370
- * T Type of set values.
1371
- * @param set1 Actual set of values.
1372
- * @param set2 Potential expected set of values.
1373
- * @param message Message to display on error.
1374
- */
1375
- sameOrderedMembers<T>(set1: T[], set2: T[], message?: string): void;
1376
-
1377
- /**
1378
- * Asserts that set1 and set2 don’t have the same members in the same order.
1379
- * Uses a strict equality check (===).
1380
- *
1381
- * T Type of set values.
1382
- * @param set1 Actual set of values.
1383
- * @param set2 Potential expected set of values.
1384
- * @param message Message to display on error.
1385
- */
1386
- notSameOrderedMembers<T>(set1: T[], set2: T[], message?: string): void;
1387
-
1388
- /**
1389
- * Asserts that set1 and set2 have the same members in the same order.
1390
- * Uses a deep equality check.
1391
- *
1392
- * T Type of set values.
1393
- * @param set1 Actual set of values.
1394
- * @param set2 Potential expected set of values.
1395
- * @param message Message to display on error.
1396
- */
1397
- sameDeepOrderedMembers<T>(set1: T[], set2: T[], message?: string): void;
1398
-
1399
- /**
1400
- * Asserts that set1 and set2 don’t have the same members in the same order.
1401
- * Uses a deep equality check.
1402
- *
1403
- * T Type of set values.
1404
- * @param set1 Actual set of values.
1405
- * @param set2 Potential expected set of values.
1406
- * @param message Message to display on error.
1407
- */
1408
- notSameDeepOrderedMembers<T>(set1: T[], set2: T[], message?: string): void;
1409
-
1410
- /**
1411
- * Asserts that subset is included in superset in the same order beginning with the first element in superset.
1412
- * Uses a strict equality check (===).
1413
- *
1414
- * T Type of set values.
1415
- * @param superset Actual set of values.
1416
- * @param subset Potential contained set of values.
1417
- * @param message Message to display on error.
1418
- */
1419
- includeOrderedMembers<T>(superset: T[], subset: T[], message?: string): void;
1420
-
1421
- /**
1422
- * Asserts that subset isn’t included in superset in the same order beginning with the first element in superset.
1423
- * Uses a strict equality check (===).
1424
- *
1425
- * T Type of set values.
1426
- * @param superset Actual set of values.
1427
- * @param subset Potential contained set of values.
1428
- * @param message Message to display on error.
1429
- */
1430
- notIncludeOrderedMembers<T>(superset: T[], subset: T[], message?: string): void;
1431
-
1432
- /**
1433
- * Asserts that subset is included in superset in the same order beginning with the first element in superset.
1434
- * Uses a deep equality check.
1435
- *
1436
- * T Type of set values.
1437
- * @param superset Actual set of values.
1438
- * @param subset Potential contained set of values.
1439
- * @param message Message to display on error.
1440
- */
1441
- includeDeepOrderedMembers<T>(superset: T[], subset: T[], message?: string): void;
1442
-
1443
- /**
1444
- * Asserts that subset isn’t included in superset in the same order beginning with the first element in superset.
1445
- * Uses a deep equality check.
1446
- *
1447
- * T Type of set values.
1448
- * @param superset Actual set of values.
1449
- * @param subset Potential contained set of values.
1450
- * @param message Message to display on error.
1451
- */
1452
- notIncludeDeepOrderedMembers<T>(superset: T[], subset: T[], message?: string): void;
1453
-
1454
- /**
1455
- * Asserts that subset is included in superset. Order is not take into account.
1456
- *
1457
- * T Type of set values.
1458
- * @param superset Actual set of values.
1459
- * @param subset Potential contained set of values.
1460
- * @param message Message to display on error.
1461
- */
1462
- includeMembers<T>(superset: T[], subset: T[], message?: string): void;
1463
-
1464
- /**
1465
- * Asserts that subset isn’t included in superset in any order.
1466
- * Uses a strict equality check (===). Duplicates are ignored.
1467
- *
1468
- * T Type of set values.
1469
- * @param superset Actual set of values.
1470
- * @param subset Potential not contained set of values.
1471
- * @param message Message to display on error.
1472
- */
1473
- notIncludeMembers<T>(superset: T[], subset: T[], message?: string): void;
1474
-
1475
- /**
1476
- * Asserts that subset is included in superset using deep equality checking.
1477
- * Order is not take into account.
1478
- *
1479
- * T Type of set values.
1480
- * @param superset Actual set of values.
1481
- * @param subset Potential contained set of values.
1482
- * @param message Message to display on error.
1483
- */
1484
- includeDeepMembers<T>(superset: T[], subset: T[], message?: string): void;
1485
-
1486
- /**
1487
- * Asserts that non-object, non-array value inList appears in the flat array list.
1488
- *
1489
- * T Type of list values.
1490
- * @param inList Value expected to be in the list.
1491
- * @param list List of values.
1492
- * @param message Message to display on error.
1493
- */
1494
- oneOf<T>(inList: T, list: T[], message?: string): void;
1495
-
1496
- /**
1497
- * Asserts that a function changes the value of a property.
1498
- *
1499
- * T Type of object.
1500
- * @param modifier Function to run.
1501
- * @param object Container object.
1502
- * @param property Property of object expected to be modified.
1503
- * @param message Message to display on error.
1504
- */
1505
- changes<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
1506
-
1507
- /**
1508
- * Asserts that a function does not change the value of a property.
1509
- *
1510
- * T Type of object.
1511
- * @param modifier Function to run.
1512
- * @param object Container object.
1513
- * @param property Property of object expected not to be modified.
1514
- * @param message Message to display on error.
1515
- */
1516
- doesNotChange<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
1517
-
1518
- /**
1519
- * Asserts that a function increases an object property.
1520
- *
1521
- * T Type of object.
1522
- * @param modifier Function to run.
1523
- * @param object Container object.
1524
- * @param property Property of object expected to be increased.
1525
- * @param message Message to display on error.
1526
- */
1527
- increases<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
1528
-
1529
- /**
1530
- * Asserts that a function does not increase an object property.
1531
- *
1532
- * T Type of object.
1533
- * @param modifier Function to run.
1534
- * @param object Container object.
1535
- * @param property Property of object expected not to be increased.
1536
- * @param message Message to display on error.
1537
- */
1538
- doesNotIncrease<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
1539
-
1540
- /**
1541
- * Asserts that a function decreases an object property.
1542
- *
1543
- * T Type of object.
1544
- * @param modifier Function to run.
1545
- * @param object Container object.
1546
- * @param property Property of object expected to be decreased.
1547
- * @param message Message to display on error.
1548
- */
1549
- decreases<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
1550
-
1551
- /**
1552
- * Asserts that a function does not decrease an object property.
1553
- *
1554
- * T Type of object.
1555
- * @param modifier Function to run.
1556
- * @param object Container object.
1557
- * @param property Property of object expected not to be decreased.
1558
- * @param message Message to display on error.
1559
- */
1560
- doesNotDecrease<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
1561
-
1562
- /**
1563
- * Asserts if value is not a false value, and throws if it is a true value.
1564
- *
1565
- * T Type of object.
1566
- * @param object Actual value.
1567
- * @param message Message to display on error.
1568
- * @remarks This is added to allow for chai to be a drop-in replacement for
1569
- * Node’s assert class.
1570
- */
1571
- ifError<T>(object: T, message?: string): void;
1572
-
1573
- /**
1574
- * Asserts that object is extensible (can have new properties added to it).
1575
- *
1576
- * T Type of object
1577
- * @param object Actual value.
1578
- * @param message Message to display on error.
1579
- */
1580
- isExtensible<T>(object: T, message?: string): void;
1581
-
1582
- /**
1583
- * Asserts that object is extensible (can have new properties added to it).
1584
- *
1585
- * T Type of object
1586
- * @param object Actual value.
1587
- * @param message Message to display on error.
1588
- */
1589
- extensible<T>(object: T, message?: string): void;
1590
-
1591
- /**
1592
- * Asserts that object is not extensible.
1593
- *
1594
- * T Type of object
1595
- * @param object Actual value.
1596
- * @param message Message to display on error.
1597
- */
1598
- isNotExtensible<T>(object: T, message?: string): void;
1599
-
1600
- /**
1601
- * Asserts that object is not extensible.
1602
- *
1603
- * T Type of object
1604
- * @param object Actual value.
1605
- * @param message Message to display on error.
1606
- */
1607
- notExtensible<T>(object: T, message?: string): void;
1608
-
1609
- /**
1610
- * Asserts that object is sealed (can have new properties added to it
1611
- * and its existing properties cannot be removed).
1612
- *
1613
- * T Type of object
1614
- * @param object Actual value.
1615
- * @param message Message to display on error.
1616
- */
1617
- isSealed<T>(object: T, message?: string): void;
1618
-
1619
- /**
1620
- * Asserts that object is sealed (can have new properties added to it
1621
- * and its existing properties cannot be removed).
1622
- *
1623
- * T Type of object
1624
- * @param object Actual value.
1625
- * @param message Message to display on error.
1626
- */
1627
- sealed<T>(object: T, message?: string): void;
1628
-
1629
- /**
1630
- * Asserts that object is not sealed.
1631
- *
1632
- * T Type of object
1633
- * @param object Actual value.
1634
- * @param message Message to display on error.
1635
- */
1636
- isNotSealed<T>(object: T, message?: string): void;
1637
-
1638
- /**
1639
- * Asserts that object is not sealed.
1640
- *
1641
- * T Type of object
1642
- * @param object Actual value.
1643
- * @param message Message to display on error.
1644
- */
1645
- notSealed<T>(object: T, message?: string): void;
1646
-
1647
- /**
1648
- * Asserts that object is frozen (cannot have new properties added to it
1649
- * and its existing properties cannot be removed).
1650
- *
1651
- * T Type of object
1652
- * @param object Actual value.
1653
- * @param message Message to display on error.
1654
- */
1655
- isFrozen<T>(object: T, message?: string): void;
1656
-
1657
- /**
1658
- * Asserts that object is frozen (cannot have new properties added to it
1659
- * and its existing properties cannot be removed).
1660
- *
1661
- * T Type of object
1662
- * @param object Actual value.
1663
- * @param message Message to display on error.
1664
- */
1665
- frozen<T>(object: T, message?: string): void;
1666
-
1667
- /**
1668
- * Asserts that object is not frozen (cannot have new properties added to it
1669
- * and its existing properties cannot be removed).
1670
- *
1671
- * T Type of object
1672
- * @param object Actual value.
1673
- * @param message Message to display on error.
1674
- */
1675
- isNotFrozen<T>(object: T, message?: string): void;
1676
-
1677
- /**
1678
- * Asserts that object is not frozen (cannot have new properties added to it
1679
- * and its existing properties cannot be removed).
1680
- *
1681
- * T Type of object
1682
- * @param object Actual value.
1683
- * @param message Message to display on error.
1684
- */
1685
- notFrozen<T>(object: T, message?: string): void;
1686
-
1687
- /**
1688
- * Asserts that the target does not contain any values. For arrays and
1689
- * strings, it checks the length property. For Map and Set instances, it
1690
- * checks the size property. For non-function objects, it gets the count
1691
- * of own enumerable string keys.
1692
- *
1693
- * T Type of object
1694
- * @param object Actual value.
1695
- * @param message Message to display on error.
1696
- */
1697
- isEmpty<T>(object: T, message?: string): void;
1698
-
1699
- /**
1700
- * Asserts that the target contains values. For arrays and strings, it checks
1701
- * the length property. For Map and Set instances, it checks the size property.
1702
- * For non-function objects, it gets the count of own enumerable string keys.
1703
- *
1704
- * T Type of object.
1705
- * @param object Object to test.
1706
- * @param message Message to display on error.
1707
- */
1708
- isNotEmpty<T>(object: T, message?: string): void;
1709
-
1710
- /**
1711
- * Asserts that `object` has at least one of the `keys` provided.
1712
- * You can also provide a single object instead of a `keys` array and its keys
1713
- * will be used as the expected set of keys.
1714
- *
1715
- * T Type of object.
1716
- * @param object Object to test.
1717
- * @param keys Keys to check
1718
- * @param message Message to display on error.
1719
- */
1720
- hasAnyKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
1721
-
1722
- /**
1723
- * Asserts that `object` has all and only all of the `keys` provided.
1724
- * You can also provide a single object instead of a `keys` array and its keys
1725
- * will be used as the expected set of keys.
1726
- *
1727
- * T Type of object.
1728
- * @param object Object to test.
1729
- * @param keys Keys to check
1730
- * @param message Message to display on error.
1731
- */
1732
- hasAllKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
1733
-
1734
- /**
1735
- * Asserts that `object` has all of the `keys` provided but may have more keys not listed.
1736
- * You can also provide a single object instead of a `keys` array and its keys
1737
- * will be used as the expected set of keys.
1738
- *
1739
- * T Type of object.
1740
- * @param object Object to test.
1741
- * @param keys Keys to check
1742
- * @param message Message to display on error.
1743
- */
1744
- containsAllKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
1745
-
1746
- /**
1747
- * Asserts that `object` has none of the `keys` provided.
1748
- * You can also provide a single object instead of a `keys` array and its keys
1749
- * will be used as the expected set of keys.
1750
- *
1751
- * T Type of object.
1752
- * @param object Object to test.
1753
- * @param keys Keys to check
1754
- * @param message Message to display on error.
1755
- */
1756
- doesNotHaveAnyKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
1757
-
1758
- /**
1759
- * Asserts that `object` does not have at least one of the `keys` provided.
1760
- * You can also provide a single object instead of a `keys` array and its keys
1761
- * will be used as the expected set of keys.
1762
- *
1763
- * T Type of object.
1764
- * @param object Object to test.
1765
- * @param keys Keys to check
1766
- * @param message Message to display on error.
1767
- */
1768
- doesNotHaveAllKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
1769
-
1770
- /**
1771
- * Asserts that `object` has at least one of the `keys` provided.
1772
- * Since Sets and Maps can have objects as keys you can use this assertion to perform
1773
- * a deep comparison.
1774
- * You can also provide a single object instead of a `keys` array and its keys
1775
- * will be used as the expected set of keys.
1776
- *
1777
- * T Type of object.
1778
- * @param object Object to test.
1779
- * @param keys Keys to check
1780
- * @param message Message to display on error.
1781
- */
1782
- hasAnyDeepKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
1783
-
1784
- /**
1785
- * Asserts that `object` has all and only all of the `keys` provided.
1786
- * Since Sets and Maps can have objects as keys you can use this assertion to perform
1787
- * a deep comparison.
1788
- * You can also provide a single object instead of a `keys` array and its keys
1789
- * will be used as the expected set of keys.
1790
- *
1791
- * T Type of object.
1792
- * @param object Object to test.
1793
- * @param keys Keys to check
1794
- * @param message Message to display on error.
1795
- */
1796
- hasAllDeepKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
1797
-
1798
- /**
1799
- * Asserts that `object` contains all of the `keys` provided.
1800
- * Since Sets and Maps can have objects as keys you can use this assertion to perform
1801
- * a deep comparison.
1802
- * You can also provide a single object instead of a `keys` array and its keys
1803
- * will be used as the expected set of keys.
1804
- *
1805
- * T Type of object.
1806
- * @param object Object to test.
1807
- * @param keys Keys to check
1808
- * @param message Message to display on error.
1809
- */
1810
- containsAllDeepKeys<T>(
1811
- object: T,
1812
- keys: Array<Object | string> | { [key: string]: any },
1813
- message?: string,
1814
- ): void;
1815
-
1816
- /**
1817
- * Asserts that `object` contains all of the `keys` provided.
1818
- * Since Sets and Maps can have objects as keys you can use this assertion to perform
1819
- * a deep comparison.
1820
- * You can also provide a single object instead of a `keys` array and its keys
1821
- * will be used as the expected set of keys.
1822
- *
1823
- * T Type of object.
1824
- * @param object Object to test.
1825
- * @param keys Keys to check
1826
- * @param message Message to display on error.
1827
- */
1828
- doesNotHaveAnyDeepKeys<T>(
1829
- object: T,
1830
- keys: Array<Object | string> | { [key: string]: any },
1831
- message?: string,
1832
- ): void;
1833
-
1834
- /**
1835
- * Asserts that `object` contains all of the `keys` provided.
1836
- * Since Sets and Maps can have objects as keys you can use this assertion to perform
1837
- * a deep comparison.
1838
- * You can also provide a single object instead of a `keys` array and its keys
1839
- * will be used as the expected set of keys.
1840
- *
1841
- * T Type of object.
1842
- * @param object Object to test.
1843
- * @param keys Keys to check
1844
- * @param message Message to display on error.
1845
- */
1846
- doesNotHaveAllDeepKeys<T>(
1847
- object: T,
1848
- keys: Array<Object | string> | { [key: string]: any },
1849
- message?: string,
1850
- ): void;
1851
-
1852
- /**
1853
- * Asserts that object has a direct or inherited property named by property,
1854
- * which can be a string using dot- and bracket-notation for nested reference.
1855
- *
1856
- * T Type of object.
1857
- * @param object Object to test.
1858
- * @param property Property to test.
1859
- * @param message Message to display on error.
1860
- */
1861
- nestedProperty<T>(object: T, property: string, message?: string): void;
1862
-
1863
- /**
1864
- * Asserts that object does not have a property named by property,
1865
- * which can be a string using dot- and bracket-notation for nested reference.
1866
- * The property cannot exist on the object nor anywhere in its prototype chain.
1867
- *
1868
- * T Type of object.
1869
- * @param object Object to test.
1870
- * @param property Property to test.
1871
- * @param message Message to display on error.
1872
- */
1873
- notNestedProperty<T>(object: T, property: string, message?: string): void;
1874
-
1875
- /**
1876
- * Asserts that object has a property named by property with value given by value.
1877
- * property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).
1878
- *
1879
- * T Type of object.
1880
- * @param object Object to test.
1881
- * @param property Property to test.
1882
- * @param value Value to test.
1883
- * @param message Message to display on error.
1884
- */
1885
- nestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void;
1886
-
1887
- /**
1888
- * Asserts that object does not have a property named by property with value given by value.
1889
- * property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).
1890
- *
1891
- * T Type of object.
1892
- * @param object Object to test.
1893
- * @param property Property to test.
1894
- * @param value Value to test.
1895
- * @param message Message to display on error.
1896
- */
1897
- notNestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void;
1898
-
1899
- /**
1900
- * Asserts that object has a property named by property with a value given by value.
1901
- * property can use dot- and bracket-notation for nested reference. Uses a deep equality check.
1902
- *
1903
- * T Type of object.
1904
- * @param object Object to test.
1905
- * @param property Property to test.
1906
- * @param value Value to test.
1907
- * @param message Message to display on error.
1908
- */
1909
- deepNestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void;
1910
-
1911
- /**
1912
- * Asserts that object does not have a property named by property with value given by value.
1913
- * property can use dot- and bracket-notation for nested reference. Uses a deep equality check.
1914
- *
1915
- * T Type of object.
1916
- * @param object Object to test.
1917
- * @param property Property to test.
1918
- * @param value Value to test.
1919
- * @param message Message to display on error.
1920
- */
1921
- notDeepNestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void;
1922
- }
1923
-
1924
- export interface Config {
1925
- /**
1926
- * Default: false
1927
- */
1928
- includeStack: boolean;
1929
-
1930
- /**
1931
- * Default: true
1932
- */
1933
- showDiff: boolean;
1934
-
1935
- /**
1936
- * Default: 40
1937
- */
1938
- truncateThreshold: number;
1939
-
1940
- /**
1941
- * Default: true
1942
- */
1943
- useProxy: boolean;
1944
-
1945
- /**
1946
- * Default: ['then', 'catch', 'inspect', 'toJSON']
1947
- */
1948
- proxyExcludedKeys: string[];
1949
- }
1950
-
1951
- export class AssertionError {
1952
- constructor(message: string, _props?: any, ssf?: Function);
1953
- name: string;
1954
- message: string;
1955
- showDiff: boolean;
1956
- stack: string;
1957
- }
1958
- }
1959
-
1960
- declare const chai: Chai.ChaiStatic;
2107
+ // }
1961
2108
 
1962
2109
  declare module "chai" {
1963
- export = chai;
2110
+ export function use(fn: Chai.ChaiPlugin): Chai.ChaiStatic;
2111
+
2112
+ export const util: Chai.ChaiUtils;
2113
+ export const config: Chai.Config;
2114
+ export const Assertion: Chai.AssertionStatic;
2115
+ export function should(): Chai.Should;
2116
+ export function Should(): Chai.Should;
2117
+ export const assert: Chai.AssertStatic;
2118
+ export const expect: Chai.ExpectStatic;
1964
2119
  }
1965
2120
 
1966
- // interface Object {
1967
- // should: Chai.Assertion;
2121
+ // declare global {
2122
+ // interface Object {
2123
+ // should: Chai.Assertion;
2124
+ // }
1968
2125
  // }