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