eslint-config-typed 3.14.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +90 -9
  2. package/dist/plugins/vitest-coding-style/rules/prefer-assert-deep-strict-equal-over-deep-equal.d.mts +6 -0
  3. package/dist/plugins/vitest-coding-style/rules/prefer-assert-deep-strict-equal-over-deep-equal.d.mts.map +1 -0
  4. package/dist/plugins/vitest-coding-style/rules/{prefer-assert-over-assert-ok.mjs → prefer-assert-deep-strict-equal-over-deep-equal.mjs} +8 -8
  5. package/dist/plugins/vitest-coding-style/rules/prefer-assert-deep-strict-equal-over-deep-equal.mjs.map +1 -0
  6. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-false-over-assert-negation.d.mts +6 -0
  7. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-false-over-assert-negation.d.mts.map +1 -0
  8. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-false-over-assert-negation.mjs +41 -0
  9. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-false-over-assert-negation.mjs.map +1 -0
  10. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-false-over-assert-not-ok.d.mts +6 -0
  11. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-false-over-assert-not-ok.d.mts.map +1 -0
  12. package/dist/plugins/vitest-coding-style/rules/{prefer-assert-not-ok-over-assert-is-not-ok.mjs → prefer-assert-is-false-over-assert-not-ok.mjs} +8 -8
  13. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-false-over-assert-not-ok.mjs.map +1 -0
  14. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-false-over-expect-false.d.mts +6 -0
  15. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-false-over-expect-false.d.mts.map +1 -0
  16. package/dist/plugins/vitest-coding-style/rules/{prefer-assert-not-ok-over-expect-false.mjs → prefer-assert-is-false-over-expect-false.mjs} +7 -7
  17. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-false-over-expect-false.mjs.map +1 -0
  18. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-true-over-assert-negated-is-false.d.mts +6 -0
  19. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-true-over-assert-negated-is-false.d.mts.map +1 -0
  20. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-true-over-assert-negated-is-false.mjs +41 -0
  21. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-true-over-assert-negated-is-false.mjs.map +1 -0
  22. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-true-over-assert.d.mts +6 -0
  23. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-true-over-assert.d.mts.map +1 -0
  24. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-true-over-assert.mjs +52 -0
  25. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-true-over-assert.mjs.map +1 -0
  26. package/dist/plugins/vitest-coding-style/rules/prefer-assert-is-true-over-expect-true.d.mts +6 -0
  27. package/dist/plugins/vitest-coding-style/rules/{prefer-assert-not-ok-over-expect-false.d.mts.map → prefer-assert-is-true-over-expect-true.d.mts.map} +1 -1
  28. package/dist/plugins/vitest-coding-style/rules/{prefer-assert-over-expect-true.mjs → prefer-assert-is-true-over-expect-true.mjs} +7 -7
  29. package/dist/plugins/vitest-coding-style/rules/{prefer-assert-not-ok-over-expect-false.mjs.map → prefer-assert-is-true-over-expect-true.mjs.map} +1 -1
  30. package/dist/plugins/vitest-coding-style/rules/rules.d.mts +7 -4
  31. package/dist/plugins/vitest-coding-style/rules/rules.d.mts.map +1 -1
  32. package/dist/plugins/vitest-coding-style/rules/rules.mjs +14 -8
  33. package/dist/plugins/vitest-coding-style/rules/rules.mjs.map +1 -1
  34. package/dist/rules/eslint-vitest-coding-style-rules.d.mts +7 -4
  35. package/dist/rules/eslint-vitest-coding-style-rules.d.mts.map +1 -1
  36. package/dist/rules/eslint-vitest-coding-style-rules.mjs +7 -4
  37. package/dist/rules/eslint-vitest-coding-style-rules.mjs.map +1 -1
  38. package/dist/types/rules/eslint-vitest-coding-style-rules.d.mts +57 -12
  39. package/dist/types/rules/eslint-vitest-coding-style-rules.d.mts.map +1 -1
  40. package/package.json +6 -1
  41. package/src/plugins/vitest-coding-style/rules/original-assert-api-type.test.mts +147 -0
  42. package/src/plugins/vitest-coding-style/rules/prefer-assert-coding-style-rules.test.mts +118 -40
  43. package/src/plugins/vitest-coding-style/rules/{prefer-assert-over-assert-ok.mts → prefer-assert-deep-strict-equal-over-deep-equal.mts} +8 -8
  44. package/src/plugins/vitest-coding-style/rules/prefer-assert-is-false-over-assert-negation.mts +53 -0
  45. package/src/plugins/vitest-coding-style/rules/{prefer-assert-not-ok-over-assert-is-not-ok.mts → prefer-assert-is-false-over-assert-not-ok.mts} +9 -8
  46. package/src/plugins/vitest-coding-style/rules/{prefer-assert-not-ok-over-expect-false.mts → prefer-assert-is-false-over-expect-false.mts} +8 -7
  47. package/src/plugins/vitest-coding-style/rules/prefer-assert-is-true-over-assert-negated-is-false.mts +53 -0
  48. package/src/plugins/vitest-coding-style/rules/prefer-assert-is-true-over-assert.mts +67 -0
  49. package/src/plugins/vitest-coding-style/rules/{prefer-assert-over-expect-true.mts → prefer-assert-is-true-over-expect-true.mts} +8 -7
  50. package/src/plugins/vitest-coding-style/rules/rules.mts +22 -10
  51. package/src/plugins/vitest-coding-style/rules/vitest-coding-style.d.mts +1574 -0
  52. package/src/rules/eslint-vitest-coding-style-rules.mts +10 -4
  53. package/src/types/rules/eslint-vitest-coding-style-rules.mts +60 -12
  54. package/dist/plugins/vitest-coding-style/rules/prefer-assert-not-ok-over-assert-is-not-ok.d.mts +0 -6
  55. package/dist/plugins/vitest-coding-style/rules/prefer-assert-not-ok-over-assert-is-not-ok.d.mts.map +0 -1
  56. package/dist/plugins/vitest-coding-style/rules/prefer-assert-not-ok-over-assert-is-not-ok.mjs.map +0 -1
  57. package/dist/plugins/vitest-coding-style/rules/prefer-assert-not-ok-over-expect-false.d.mts +0 -6
  58. package/dist/plugins/vitest-coding-style/rules/prefer-assert-over-assert-ok.d.mts +0 -6
  59. package/dist/plugins/vitest-coding-style/rules/prefer-assert-over-assert-ok.d.mts.map +0 -1
  60. package/dist/plugins/vitest-coding-style/rules/prefer-assert-over-assert-ok.mjs.map +0 -1
  61. package/dist/plugins/vitest-coding-style/rules/prefer-assert-over-expect-true.d.mts +0 -6
  62. package/dist/plugins/vitest-coding-style/rules/prefer-assert-over-expect-true.d.mts.map +0 -1
  63. package/dist/plugins/vitest-coding-style/rules/prefer-assert-over-expect-true.mjs.map +0 -1
@@ -0,0 +1,1574 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-function-type */
2
+ /* eslint-disable @typescript-eslint/no-restricted-types */
3
+ // eslint-disable-next-line vitest/no-importing-vitest-globals
4
+ import { type assert as originalAssert } from 'vitest';
5
+
6
+ declare global {
7
+ const assert: Pick<originalAssert, never> & OverriddenAssert;
8
+ }
9
+
10
+ type OverriddenAssert = Readonly<{
11
+ /**
12
+ * Asserts that value is true.
13
+ *
14
+ * @param value Actual value.
15
+ */
16
+ isTrue: (value: boolean) => asserts value;
17
+
18
+ /**
19
+ * Asserts that value is false.
20
+ *
21
+ * @param value Actual value.
22
+ */
23
+ isFalse: (value: boolean) => asserts value is false;
24
+
25
+ // ModifiedChai.Assert
26
+ //
27
+ // - Removed optional `message` arg
28
+ // - Convert arg types to be readonly
29
+ // - Replace `Object` with `object`
30
+ // - Removed the call signature
31
+ // - Removed deepEqual, equal, notEqual, ok, notOk, isOk, isNotOk, isTrue, isFalse
32
+ // - deepEqual // Removed in favor of assert.deepStrictEqual
33
+ // - equal // Removed in favor of assert.strictEqual
34
+ // - notEqual // Removed in favor of assert.notStrictEqual
35
+ // - ok // Removed in favor of assert.isTrue
36
+ // - notOk // Removed in favor of assert.isFalse
37
+ // - isOk // Removed in favor of assert.isTrue
38
+ // - isNotOk // Removed in favor of assert.isFalse
39
+ // - isTrue // Overridden with OverriddenAssert
40
+ // - isFalse // Overridden with OverriddenAssert
41
+
42
+ // /**
43
+ // * @param expression Expression to test for truthiness.
44
+ // */
45
+ // (expression: unknown): asserts expression;
46
+
47
+ /**
48
+ * Throws a failure.
49
+ *
50
+ * @remarks Node.js assert module-compatible.
51
+ */
52
+ fail: (() => never) &
53
+ (<T>(actual: T, expected: T, operator?: Operator) => never);
54
+
55
+ // /**
56
+ // * Asserts that object is truthy.
57
+ // *
58
+ // * @param object Object to test.
59
+ // */
60
+ // isOk: (value: unknown) => asserts value;
61
+
62
+ // /**
63
+ // * Asserts that object is truthy.
64
+ // *
65
+ // * @param object Object to test.
66
+ // */
67
+ // ok: (value: unknown) => asserts value;
68
+
69
+ // /**
70
+ // * Asserts that object is falsy.
71
+ // *
72
+ // * T Type of object.
73
+ // * @param object Object to test.
74
+ // */
75
+ // isNotOk: <T>(value: T) => void;
76
+
77
+ // /**
78
+ // * Asserts that object is falsy.
79
+ // *
80
+ // * T Type of object.
81
+ // * @param object Object to test.
82
+ // */
83
+ // notOk: <T>(value: T) => void;
84
+
85
+ // /**
86
+ // * Asserts non-strict equality (==) of actual and expected.
87
+ // *
88
+ // * T Type of the objects.
89
+ // * @param actual Actual value.
90
+ // * @param expected Potential expected value.
91
+ // */
92
+ // equal: <T>(actual: T, expected: T) => void;
93
+
94
+ // /**
95
+ // * Asserts non-strict inequality (!=) of actual and expected.
96
+ // *
97
+ // * T Type of the objects.
98
+ // * @param actual Actual value.
99
+ // * @param expected Potential expected value.
100
+ // */
101
+ // notEqual: <T>(actual: T, expected: T) => void;
102
+
103
+ /**
104
+ * Asserts strict equality (===) of actual and expected.
105
+ *
106
+ * T Type of the objects.
107
+ * @param actual Actual value.
108
+ * @param expected Potential expected value.
109
+ */
110
+ strictEqual: <T>(actual: T, expected: T) => void;
111
+
112
+ /**
113
+ * Asserts strict inequality (!==) of actual and expected.
114
+ *
115
+ * T Type of the objects.
116
+ * @param actual Actual value.
117
+ * @param expected Potential expected value.
118
+ */
119
+ notStrictEqual: <T>(actual: T, expected: T) => void;
120
+
121
+ // /**
122
+ // * Asserts that actual is deeply equal to expected.
123
+ // *
124
+ // * T Type of the objects.
125
+ // * @param actual Actual value.
126
+ // * @param expected Potential expected value.
127
+ // */
128
+ // deepEqual: <T>(actual: T, expected: T) => void;
129
+
130
+ /**
131
+ * Asserts that actual is not deeply equal to expected.
132
+ *
133
+ * T Type of the objects.
134
+ * @param actual Actual value.
135
+ * @param expected Potential expected value.
136
+ */
137
+ notDeepEqual: <T>(actual: T, expected: T) => void;
138
+
139
+ /**
140
+ * Alias to deepEqual
141
+ *
142
+ * T Type of the objects.
143
+ * @param actual Actual value.
144
+ * @param expected Potential expected value.
145
+ */
146
+ deepStrictEqual: <T>(actual: T, expected: T) => void;
147
+
148
+ /**
149
+ * Partially matches actual and expected.
150
+ *
151
+ * @param actual Actual value.
152
+ * @param expected Potential subset of the value.
153
+ */
154
+ containSubset: (val: unknown, exp: unknown, msg?: string) => void;
155
+
156
+ /**
157
+ * Partially matches actual and expected.
158
+ *
159
+ * @param actual Actual value.
160
+ * @param expected Potential subset of the value.
161
+ */
162
+ containsSubset: (val: unknown, exp: unknown, msg?: string) => void;
163
+
164
+ /**
165
+ * No partial match between actual and expected exists.
166
+ *
167
+ * @param actual Actual value.
168
+ * @param expected Potential subset of the value.
169
+ */
170
+ doesNotContainSubset: (val: unknown, exp: unknown, msg?: string) => void;
171
+
172
+ /**
173
+ * Asserts valueToCheck is strictly greater than (>) valueToBeAbove.
174
+ *
175
+ * @param valueToCheck Actual value.
176
+ * @param valueToBeAbove Minimum Potential expected value.
177
+ */
178
+ isAbove: (valueToCheck: number, valueToBeAbove: number) => void;
179
+
180
+ /**
181
+ * Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast.
182
+ *
183
+ * @param valueToCheck Actual value.
184
+ * @param valueToBeAtLeast Minimum Potential expected value.
185
+ */
186
+ isAtLeast: (valueToCheck: number, valueToBeAtLeast: number) => void;
187
+
188
+ /**
189
+ * Asserts valueToCheck is strictly less than (<) valueToBeBelow.
190
+ *
191
+ * @param valueToCheck Actual value.
192
+ * @param valueToBeBelow Minimum Potential expected value.
193
+ */
194
+ isBelow: (valueToCheck: number, valueToBeBelow: number) => void;
195
+
196
+ /**
197
+ * Asserts valueToCheck is less than or equal to (<=) valueToBeAtMost.
198
+ *
199
+ * @param valueToCheck Actual value.
200
+ * @param valueToBeAtMost Minimum Potential expected value.
201
+ */
202
+ isAtMost: (valueToCheck: number, valueToBeAtMost: number) => void;
203
+
204
+ // /**
205
+ // * Asserts that value is true.
206
+ // *
207
+ // * @param value Actual value.
208
+ // */
209
+ // isTrue: (value: unknown) => asserts value is true;
210
+
211
+ // /**
212
+ // * Asserts that value is false.
213
+ // *
214
+ // * @param value Actual value.
215
+ // */
216
+ // isFalse: (value: unknown) => asserts value is false;
217
+
218
+ /**
219
+ * Asserts that value is not true.
220
+ *
221
+ * T Type of value.
222
+ * @param value Actual value.
223
+ */
224
+ isNotTrue: <T>(value: T) => asserts value is Exclude<T, true>;
225
+
226
+ /**
227
+ * Asserts that value is not false.
228
+ *
229
+ * @param value Actual value.
230
+ */
231
+ isNotFalse: <T>(value: T) => asserts value is Exclude<T, false>;
232
+
233
+ /**
234
+ * Asserts that value is null.
235
+ *
236
+ * @param value Actual value.
237
+ */
238
+ isNull: (value: unknown) => asserts value is null;
239
+
240
+ /**
241
+ * Asserts that value is not null.
242
+ *
243
+ * T Type of value.
244
+ * @param value Actual value.
245
+ */
246
+ isNotNull: <T>(value: T) => asserts value is Exclude<T, null>;
247
+
248
+ /**
249
+ * Asserts that value is NaN.
250
+ *
251
+ * T Type of value.
252
+ * @param value Actual value.
253
+ */
254
+ isNaN: <T>(value: T) => void;
255
+
256
+ /**
257
+ * Asserts that value is not NaN.
258
+ *
259
+ * T Type of value.
260
+ * @param value Actual value.
261
+ */
262
+ isNotNaN: <T>(value: T) => void;
263
+
264
+ /**
265
+ * Asserts that the target is neither null nor undefined.
266
+ *
267
+ * T Type of value.
268
+ * @param value Actual value.
269
+ */
270
+ exists: <T>(value: T) => asserts value is NonNullable<T>;
271
+
272
+ /**
273
+ * Asserts that the target is either null or undefined.
274
+ *
275
+ * @param value Actual value.
276
+ */
277
+ notExists: (value: unknown) => asserts value is null | undefined;
278
+
279
+ /**
280
+ * Asserts that value is undefined.
281
+ *
282
+ * @param value Actual value.
283
+ */
284
+ isUndefined: (value: unknown) => asserts value is undefined;
285
+
286
+ /**
287
+ * Asserts that value is not undefined.
288
+ *
289
+ * T Type of value.
290
+ * @param value Actual value.
291
+ */
292
+ isDefined: <T>(value: T) => asserts value is Exclude<T, undefined>;
293
+
294
+ /**
295
+ * Asserts that value is a function.
296
+ *
297
+ * T Type of value.
298
+ * @param value Actual value.
299
+ */
300
+ isFunction: <T>(value: T) => void;
301
+
302
+ /**
303
+ * Asserts that value is not a function.
304
+ *
305
+ * T Type of value.
306
+ * @param value Actual value.
307
+ */
308
+ isNotFunction: <T>(value: T) => void;
309
+
310
+ /**
311
+ * Asserts that value is an object of type 'Object'
312
+ * (as revealed by Object.prototype.toString).
313
+ *
314
+ * T Type of value.
315
+ * @param value Actual value.
316
+ * @remarks The assertion does not match subclassed objects.
317
+ */
318
+ isObject: <T>(value: T) => void;
319
+
320
+ /**
321
+ * Asserts that value is not an object of type 'Object'
322
+ * (as revealed by Object.prototype.toString).
323
+ *
324
+ * T Type of value.
325
+ * @param value Actual value.
326
+ */
327
+ isNotObject: <T>(value: T) => void;
328
+
329
+ /**
330
+ * Asserts that value is an array.
331
+ *
332
+ * T Type of value.
333
+ * @param value Actual value.
334
+ */
335
+ isArray: <T>(value: T) => void;
336
+
337
+ /**
338
+ * Asserts that value is not an array.
339
+ *
340
+ * T Type of value.
341
+ * @param value Actual value.
342
+ */
343
+ isNotArray: <T>(value: T) => void;
344
+
345
+ /**
346
+ * Asserts that value is a string.
347
+ *
348
+ * T Type of value.
349
+ * @param value Actual value.
350
+ */
351
+ isString: <T>(value: T) => void;
352
+
353
+ /**
354
+ * Asserts that value is not a string.
355
+ *
356
+ * T Type of value.
357
+ * @param value Actual value.
358
+ */
359
+ isNotString: <T>(value: T) => void;
360
+
361
+ /**
362
+ * Asserts that value is a number.
363
+ *
364
+ * T Type of value.
365
+ * @param value Actual value.
366
+ */
367
+ isNumber: <T>(value: T) => void;
368
+
369
+ /**
370
+ * Asserts that value is not a number.
371
+ *
372
+ * T Type of value.
373
+ * @param value Actual value.
374
+ */
375
+ isNotNumber: <T>(value: T) => void;
376
+
377
+ /**
378
+ * Asserts that value is a finite number.
379
+ * Unlike `.isNumber`, this will fail for `NaN` and `Infinity`.
380
+ *
381
+ * T Type of value
382
+ * @param value Actual value
383
+ */
384
+ isFinite: <T>(value: T) => void;
385
+
386
+ /**
387
+ * Asserts that value is a boolean.
388
+ *
389
+ * T Type of value.
390
+ * @param value Actual value.
391
+ */
392
+ isBoolean: <T>(value: T) => void;
393
+
394
+ /**
395
+ * Asserts that value is not a boolean.
396
+ *
397
+ * T Type of value.
398
+ * @param value Actual value.
399
+ */
400
+ isNotBoolean: <T>(value: T) => void;
401
+
402
+ /**
403
+ * Asserts that value's type is name, as determined by Object.prototype.toString.
404
+ *
405
+ * T Type of value.
406
+ * @param value Actual value.
407
+ * @param name Potential expected type name of value.
408
+ */
409
+ typeOf: <T>(value: T, name: string) => void;
410
+
411
+ /**
412
+ * Asserts that value's type is not name, as determined by Object.prototype.toString.
413
+ *
414
+ * T Type of value.
415
+ * @param value Actual value.
416
+ * @param name Potential expected type name of value.
417
+ */
418
+ notTypeOf: <T>(value: T, name: string) => void;
419
+
420
+ /**
421
+ * Asserts that value is an instance of constructor.
422
+ *
423
+ * T Expected type of value.
424
+ * @param value Actual value.
425
+ * @param ctor Potential expected constructor of value.
426
+ */
427
+ instanceOf: <T>(value: unknown, ctor: Constructor<T>) => asserts value is T;
428
+
429
+ /**
430
+ * Asserts that value is not an instance of constructor.
431
+ *
432
+ * T Type of value.
433
+ * U Type that value shouldn't be an instance of.
434
+ * @param value Actual value.
435
+ * @param ctor Potential expected constructor of value.
436
+ */
437
+ notInstanceOf: <T, U>(
438
+ value: T,
439
+ ctor: Constructor<U>,
440
+ ) => asserts value is Exclude<T, U>;
441
+
442
+ /**
443
+ * Asserts that haystack includes needle.
444
+ *
445
+ * @param haystack Container string.
446
+ * @param needle Potential substring of haystack.
447
+ */
448
+ include: ((haystack: string, needle: string) => void) &
449
+ (<T>(
450
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
451
+ haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
452
+ needle: T,
453
+ ) => void) &
454
+ (<T extends object>(haystack: WeakSet<T>, needle: T) => void) &
455
+ (<T>(haystack: T, needle: Partial<T>) => void);
456
+
457
+ /**
458
+ * Asserts that haystack does not include needle.
459
+ *
460
+ * @param haystack Container string.
461
+ * @param needle Potential substring of haystack.
462
+ */
463
+ notInclude: ((haystack: string, needle: string) => void) &
464
+ (<T>(
465
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
466
+ haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
467
+ needle: T,
468
+ ) => void) &
469
+ (<T extends object>(haystack: WeakSet<T>, needle: T) => void) &
470
+ (<T>(haystack: T, needle: Partial<T>) => void);
471
+
472
+ /**
473
+ * Asserts that haystack includes needle. Deep equality is used.
474
+ *
475
+ * @param haystack Container string.
476
+ * @param needle Potential substring of haystack.
477
+ *
478
+ * @deprecated Does not have any effect on string. Use {@link Assert#include} instead.
479
+ */
480
+ deepInclude: ((haystack: string, needle: string) => void) &
481
+ (<T>(
482
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
483
+ haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
484
+ needle: T,
485
+ ) => void) &
486
+ (<T>(
487
+ haystack: T,
488
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
489
+ needle: T extends WeakSet<any> ? never : Partial<T>,
490
+ ) => void);
491
+
492
+ /**
493
+ * Asserts that haystack does not include needle. Deep equality is used.
494
+ *
495
+ * @param haystack Container string.
496
+ * @param needle Potential substring of haystack.
497
+ *
498
+ * @deprecated Does not have any effect on string. Use {@link Assert#notInclude} instead.
499
+ */
500
+ notDeepInclude: ((haystack: string, needle: string) => void) &
501
+ (<T>(
502
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
503
+ haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
504
+ needle: T,
505
+ ) => void) &
506
+ (<T>(
507
+ haystack: T,
508
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
509
+ needle: T extends WeakSet<any> ? never : Partial<T>,
510
+ ) => void);
511
+
512
+ /**
513
+ * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object.
514
+ *
515
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
516
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
517
+ * Can be used to assert the inclusion of a subset of properties in an object.
518
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
519
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
520
+ *
521
+ * @param haystack
522
+ * @param needle
523
+ */
524
+ nestedInclude: (haystack: unknown, needle: unknown) => void;
525
+
526
+ /**
527
+ * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object.
528
+ *
529
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
530
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
531
+ * Can be used to assert the inclusion of a subset of properties in an object.
532
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
533
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
534
+ *
535
+ * @param haystack
536
+ * @param needle
537
+ */
538
+ notNestedInclude: (haystack: unknown, needle: unknown) => void;
539
+
540
+ /**
541
+ * 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
542
+ *
543
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
544
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
545
+ * Can be used to assert the inclusion of a subset of properties in an object.
546
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
547
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
548
+ *
549
+ * @param haystack
550
+ * @param needle
551
+ */
552
+ deepNestedInclude: (haystack: unknown, needle: unknown) => void;
553
+
554
+ /**
555
+ * 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.
556
+ *
557
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
558
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
559
+ * Can be used to assert the inclusion of a subset of properties in an object.
560
+ * Enables the use of dot- and bracket-notation for referencing nested properties.
561
+ * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
562
+ *
563
+ * @param haystack
564
+ * @param needle
565
+ */
566
+ notDeepNestedInclude: (haystack: unknown, needle: unknown) => void;
567
+
568
+ /**
569
+ * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties.
570
+ *
571
+ * @param haystack
572
+ * @param needle
573
+ */
574
+ ownInclude: (haystack: unknown, needle: unknown) => void;
575
+
576
+ /**
577
+ * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties.
578
+ *
579
+ * @param haystack
580
+ * @param needle
581
+ */
582
+ notOwnInclude: (haystack: unknown, needle: unknown) => void;
583
+
584
+ /**
585
+ * 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
586
+ *
587
+ * @param haystack
588
+ * @param needle
589
+ */
590
+ deepOwnInclude: (haystack: unknown, needle: unknown) => void;
591
+
592
+ /**
593
+ * 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.
594
+ *
595
+ * @param haystack
596
+ * @param needle
597
+ */
598
+ notDeepOwnInclude: (haystack: unknown, needle: unknown) => void;
599
+
600
+ /**
601
+ * Asserts that value matches the regular expression regexp.
602
+ *
603
+ * @param value Actual value.
604
+ * @param regexp Potential match of value.
605
+ */
606
+ match: (value: string, regexp: RegExp) => void;
607
+
608
+ /**
609
+ * Asserts that value does not match the regular expression regexp.
610
+ *
611
+ * @param value Actual value.
612
+ * @param regexp Potential match of value.
613
+ */
614
+ notMatch: (expected: unknown, regexp: RegExp) => void;
615
+
616
+ /**
617
+ * Asserts that object has a property named by property.
618
+ *
619
+ * T Type of object.
620
+ * @param object Container object.
621
+ * @param property Potential contained property of object.
622
+ */
623
+ property: <T>(object: T, property: string /* keyof T */) => void;
624
+
625
+ /**
626
+ * Asserts that object does not have a property named by property.
627
+ *
628
+ * T Type of object.
629
+ * @param object Container object.
630
+ * @param property Potential contained property of object.
631
+ */
632
+ notProperty: <T>(object: T, property: string /* keyof T */) => void;
633
+
634
+ /**
635
+ * Asserts that object has a property named by property, which can be a string
636
+ * using dot- and bracket-notation for deep reference.
637
+ *
638
+ * T Type of object.
639
+ * @param object Container object.
640
+ * @param property Potential contained property of object.
641
+ */
642
+ deepProperty: <T>(object: T, property: string) => void;
643
+
644
+ /**
645
+ * Asserts that object does not have a property named by property, which can be a
646
+ * string using dot- and bracket-notation for deep reference.
647
+ *
648
+ * T Type of object.
649
+ * @param object Container object.
650
+ * @param property Potential contained property of object.
651
+ */
652
+ notDeepProperty: <T>(object: T, property: string) => void;
653
+
654
+ /**
655
+ * Asserts that object has a property named by property with value given by value.
656
+ *
657
+ * T Type of object.
658
+ * V Type of value.
659
+ * @param object Container object.
660
+ * @param property Potential contained property of object.
661
+ * @param value Potential expected property value.
662
+ */
663
+ propertyVal: <T, V>(
664
+ object: T,
665
+ property: string /* keyof T */,
666
+ value: V,
667
+ ) => void;
668
+
669
+ /**
670
+ * Asserts that object has a property named by property with value given by value.
671
+ *
672
+ * T Type of object.
673
+ * V Type of value.
674
+ * @param object Container object.
675
+ * @param property Potential contained property of object.
676
+ * @param value Potential expected property value.
677
+ */
678
+ notPropertyVal: <T, V>(
679
+ object: T,
680
+ property: string /* keyof T */,
681
+ value: V,
682
+ ) => void;
683
+
684
+ /**
685
+ * Asserts that object has a property named by property, which can be a string
686
+ * using dot- and bracket-notation for deep reference.
687
+ *
688
+ * T Type of object.
689
+ * V Type of value.
690
+ * @param object Container object.
691
+ * @param property Potential contained property of object.
692
+ * @param value Potential expected property value.
693
+ */
694
+ deepPropertyVal: <T, V>(object: T, property: string, value: V) => void;
695
+
696
+ /**
697
+ * Asserts that object does not have a property named by property, which can be a
698
+ * string using dot- and bracket-notation for deep reference.
699
+ *
700
+ * T Type of object.
701
+ * V Type of value.
702
+ * @param object Container object.
703
+ * @param property Potential contained property of object.
704
+ * @param value Potential expected property value.
705
+ */
706
+ notDeepPropertyVal: <T, V>(object: T, property: string, value: V) => void;
707
+
708
+ /**
709
+ * Asserts that object has a length property with the expected value.
710
+ *
711
+ * T Type of object.
712
+ * @param object Container object.
713
+ * @param length Potential expected length of object.
714
+ */
715
+ lengthOf: <
716
+ T extends
717
+ | Readonly<{ length?: number | undefined }>
718
+ | Readonly<{ size?: number | undefined }>,
719
+ >(
720
+ object: T,
721
+ length: number,
722
+ ) => void;
723
+
724
+ /**
725
+ * Asserts that fn will throw an error.
726
+ *
727
+ * @param fn Function that may throw.
728
+ * @param errMsgMatcher Expected error message matcher.
729
+ * @param ignored Ignored parameter.
730
+ */
731
+ throw: ((
732
+ fn: () => void,
733
+ errMsgMatcher?: RegExp | string,
734
+ ignored?: unknown,
735
+ ) => void) &
736
+ ((
737
+ fn: () => void,
738
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
739
+ errorLike?: ErrorConstructor | Error | null,
740
+ errMsgMatcher?: RegExp | string | null,
741
+ ) => void);
742
+
743
+ /**
744
+ * Asserts that fn will throw an error.
745
+ *
746
+ * @param fn Function that may throw.
747
+ * @param errMsgMatcher Expected error message matcher.
748
+ * @param ignored Ignored parameter.
749
+ */
750
+ throws: ((
751
+ fn: () => void,
752
+ errMsgMatcher?: RegExp | string,
753
+ ignored?: unknown,
754
+ ) => void) &
755
+ ((
756
+ fn: () => void,
757
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
758
+ errorLike?: ErrorConstructor | Error | null,
759
+ errMsgMatcher?: RegExp | string | null,
760
+ ) => void);
761
+
762
+ /**
763
+ * Asserts that fn will throw an error.
764
+ *
765
+ * @param fn Function that may throw.
766
+ * @param errMsgMatcher Expected error message matcher.
767
+ * @param ignored Ignored parameter.
768
+ */
769
+ Throw: ((
770
+ fn: () => void,
771
+ errMsgMatcher?: RegExp | string,
772
+ ignored?: unknown,
773
+ ) => void) &
774
+ ((
775
+ fn: () => void,
776
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
777
+ errorLike?: ErrorConstructor | Error | null,
778
+ errMsgMatcher?: RegExp | string | null,
779
+ ) => void);
780
+
781
+ /**
782
+ * Asserts that fn will not throw an error.
783
+ *
784
+ * @param fn Function that may throw.
785
+ * @param errMsgMatcher Expected error message matcher.
786
+ * @param ignored Ignored parameter.
787
+ */
788
+ doesNotThrow: ((
789
+ fn: () => void,
790
+ errMsgMatcher?: RegExp | string,
791
+ ignored?: unknown,
792
+ ) => void) &
793
+ ((
794
+ fn: () => void,
795
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
796
+ errorLike?: ErrorConstructor | Error | null,
797
+ errMsgMatcher?: RegExp | string | null,
798
+ ) => void);
799
+
800
+ /**
801
+ * Compares two values using operator.
802
+ *
803
+ * @param val1 Left value during comparison.
804
+ * @param operator Comparison operator.
805
+ * @param val2 Right value during comparison.
806
+ */
807
+ operator: (
808
+ val1: OperatorComparable,
809
+ operator: Operator,
810
+ val2: OperatorComparable,
811
+ ) => void;
812
+
813
+ /**
814
+ * Asserts that the target is equal to expected, to within a +/- delta range.
815
+ *
816
+ * @param actual Actual value
817
+ * @param expected Potential expected value.
818
+ * @param delta Maximum difference between values.
819
+ */
820
+ closeTo: (actual: number, expected: number, delta: number) => void;
821
+
822
+ /**
823
+ * Asserts that the target is equal to expected, to within a +/- delta range.
824
+ *
825
+ * @param actual Actual value
826
+ * @param expected Potential expected value.
827
+ * @param delta Maximum difference between values.
828
+ */
829
+ approximately: (act: number, exp: number, delta: number) => void;
830
+
831
+ /**
832
+ * Asserts that set1 and set2 have the same members. Order is not take into account.
833
+ *
834
+ * T Type of set values.
835
+ * @param set1 Actual set of values.
836
+ * @param set2 Potential expected set of values.
837
+ */
838
+ sameMembers: <T>(set1: readonly T[], set2: readonly T[]) => void;
839
+
840
+ /**
841
+ * Asserts that set1 and set2 have the same members using deep equality checking.
842
+ * Order is not take into account.
843
+ *
844
+ * T Type of set values.
845
+ * @param set1 Actual set of values.
846
+ * @param set2 Potential expected set of values.
847
+ */
848
+ sameDeepMembers: <T>(set1: readonly T[], set2: readonly T[]) => void;
849
+
850
+ /**
851
+ * Asserts that `set1` and `set2` don't have the same members in any order.
852
+ * Uses a deep equality check.
853
+ *
854
+ * T Type of set values.
855
+ * @param set1
856
+ * @param set2
857
+ */
858
+ notSameDeepMembers: <T>(set1: readonly T[], set2: readonly T[]) => void;
859
+
860
+ /**
861
+ * Asserts that set1 and set2 have the same members in the same order.
862
+ * Uses a strict equality check (===).
863
+ *
864
+ * T Type of set values.
865
+ * @param set1 Actual set of values.
866
+ * @param set2 Potential expected set of values.
867
+ */
868
+ sameOrderedMembers: <T>(set1: readonly T[], set2: readonly T[]) => void;
869
+
870
+ /**
871
+ * Asserts that set1 and set2 don’t have the same members in the same order.
872
+ * Uses a strict equality check (===).
873
+ *
874
+ * T Type of set values.
875
+ * @param set1 Actual set of values.
876
+ * @param set2 Potential expected set of values.
877
+ */
878
+ notSameOrderedMembers: <T>(set1: readonly T[], set2: readonly T[]) => void;
879
+
880
+ /**
881
+ * Asserts that set1 and set2 have the same members in the same order.
882
+ * Uses a deep equality check.
883
+ *
884
+ * T Type of set values.
885
+ * @param set1 Actual set of values.
886
+ * @param set2 Potential expected set of values.
887
+ */
888
+ sameDeepOrderedMembers: <T>(set1: readonly T[], set2: readonly T[]) => void;
889
+
890
+ /**
891
+ * Asserts that set1 and set2 don’t have the same members in the same order.
892
+ * Uses a deep equality check.
893
+ *
894
+ * T Type of set values.
895
+ * @param set1 Actual set of values.
896
+ * @param set2 Potential expected set of values.
897
+ */
898
+ notSameDeepOrderedMembers: <T>(
899
+ set1: readonly T[],
900
+ set2: readonly T[],
901
+ ) => void;
902
+
903
+ /**
904
+ * Asserts that subset is included in superset in the same order beginning with the first element in superset.
905
+ * Uses a strict equality check (===).
906
+ *
907
+ * T Type of set values.
908
+ * @param superset Actual set of values.
909
+ * @param subset Potential contained set of values.
910
+ */
911
+ includeOrderedMembers: <T>(
912
+ superset: readonly T[],
913
+ subset: readonly T[],
914
+ ) => void;
915
+
916
+ /**
917
+ * Asserts that subset isn’t included in superset in the same order beginning with the first element in superset.
918
+ * Uses a strict equality check (===).
919
+ *
920
+ * T Type of set values.
921
+ * @param superset Actual set of values.
922
+ * @param subset Potential contained set of values.
923
+ */
924
+ notIncludeOrderedMembers: <T>(
925
+ superset: readonly T[],
926
+ subset: readonly T[],
927
+ ) => void;
928
+
929
+ /**
930
+ * Asserts that subset is included in superset in the same order beginning with the first element in superset.
931
+ * Uses a deep equality check.
932
+ *
933
+ * T Type of set values.
934
+ * @param superset Actual set of values.
935
+ * @param subset Potential contained set of values.
936
+ */
937
+ includeDeepOrderedMembers: <T>(
938
+ superset: readonly T[],
939
+ subset: readonly T[],
940
+ ) => void;
941
+
942
+ /**
943
+ * Asserts that subset isn’t included in superset in the same order beginning with the first element in superset.
944
+ * Uses a deep equality check.
945
+ *
946
+ * T Type of set values.
947
+ * @param superset Actual set of values.
948
+ * @param subset Potential contained set of values.
949
+ */
950
+ notIncludeDeepOrderedMembers: <T>(
951
+ superset: readonly T[],
952
+ subset: readonly T[],
953
+ ) => void;
954
+
955
+ /**
956
+ * Asserts that subset is included in superset. Order is not take into account.
957
+ *
958
+ * T Type of set values.
959
+ * @param superset Actual set of values.
960
+ * @param subset Potential contained set of values.
961
+ */
962
+ includeMembers: <T>(superset: readonly T[], subset: readonly T[]) => void;
963
+
964
+ /**
965
+ * Asserts that subset isn’t included in superset in any order.
966
+ * Uses a strict equality check (===). Duplicates are ignored.
967
+ *
968
+ * T Type of set values.
969
+ * @param superset Actual set of values.
970
+ * @param subset Potential not contained set of values.
971
+ */
972
+ notIncludeMembers: <T>(superset: readonly T[], subset: readonly T[]) => void;
973
+
974
+ /**
975
+ * Asserts that subset is included in superset using deep equality checking.
976
+ * Order is not take into account.
977
+ *
978
+ * T Type of set values.
979
+ * @param superset Actual set of values.
980
+ * @param subset Potential contained set of values.
981
+ */
982
+ includeDeepMembers: <T>(superset: readonly T[], subset: readonly T[]) => void;
983
+
984
+ /**
985
+ * Asserts that `subset` isn't included in `superset` in any order. Uses a
986
+ * deep equality check. Duplicates are ignored.
987
+ *
988
+ * assert.notIncludeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { f: 5 } ], 'not include deep members');
989
+ *
990
+ * T Type of set values.
991
+ * @param superset Actual set of values.
992
+ * @param subset Potential contained set of values.
993
+ */
994
+ notIncludeDeepMembers: <T>(
995
+ superset: readonly T[],
996
+ subset: readonly T[],
997
+ ) => void;
998
+
999
+ /**
1000
+ * Asserts that non-object, non-array value inList appears in the flat array list.
1001
+ *
1002
+ * T Type of list values.
1003
+ * @param inList Value expected to be in the list.
1004
+ * @param list List of values.
1005
+ */
1006
+ oneOf: <T>(inList: T, list: readonly T[]) => void;
1007
+
1008
+ /**
1009
+ * Asserts that a function changes the value of a property.
1010
+ *
1011
+ * T Type of object.
1012
+ * @param modifier Function to run.
1013
+ * @param object Container object.
1014
+ * @param property Property of object expected to be modified.
1015
+ */
1016
+ changes: <T>(
1017
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1018
+ modifier: Function,
1019
+ object: T,
1020
+ property: string /* keyof T */,
1021
+ ) => void;
1022
+
1023
+ /**
1024
+ * Asserts that a function changes the value of a property by an amount (delta).
1025
+ *
1026
+ * @param modifier function
1027
+ * @param object or getter function
1028
+ * @param property name _optional_
1029
+ * @param change amount (delta)
1030
+ */
1031
+ changesBy: (<T>(
1032
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1033
+ modifier: Function,
1034
+ object: T,
1035
+ property: string /* keyof T */,
1036
+ change: number,
1037
+ ) => void) &
1038
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1039
+ (<T>(modifier: Function, object: T, change: number) => void);
1040
+
1041
+ /**
1042
+ * Asserts that a function does not change the value of a property.
1043
+ *
1044
+ * T Type of object.
1045
+ * @param modifier Function to run.
1046
+ * @param object Container object.
1047
+ * @param property Property of object expected not to be modified.
1048
+ */
1049
+ doesNotChange: <T>(
1050
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1051
+ modifier: Function,
1052
+ object: T,
1053
+ property: string /* keyof T */,
1054
+ ) => void;
1055
+
1056
+ /**
1057
+ * Asserts that a function increases an object property.
1058
+ *
1059
+ * T Type of object.
1060
+ * @param modifier Function to run.
1061
+ * @param object Container object.
1062
+ * @param property Property of object expected to be increased.
1063
+ */
1064
+ increases: <T>(
1065
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1066
+ modifier: Function,
1067
+ object: T,
1068
+ property: string /* keyof T */,
1069
+ ) => void;
1070
+
1071
+ /**
1072
+ * Asserts that a function increases a numeric object property or a function's return value by an amount (delta).
1073
+ *
1074
+ * T Type of object or function.
1075
+ * @param modifier function
1076
+ * @param object or getter function
1077
+ * @param property name _optional_
1078
+ * @param change amount (delta)
1079
+ */
1080
+ increasesBy: (<T>(
1081
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1082
+ modifier: Function,
1083
+ object: T,
1084
+ property: string /* keyof T */,
1085
+ change: number,
1086
+ ) => void) &
1087
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1088
+ (<T>(modifier: Function, object: T, change: number) => void);
1089
+
1090
+ /**
1091
+ * Asserts that a function does not increase an object property.
1092
+ *
1093
+ * T Type of object.
1094
+ * @param modifier Function to run.
1095
+ * @param object Container object.
1096
+ * @param property Property of object expected not to be increased.
1097
+ */
1098
+ doesNotIncrease: <T>(
1099
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1100
+ modifier: Function,
1101
+ object: T,
1102
+ property: string /* keyof T */,
1103
+ ) => void;
1104
+
1105
+ /**
1106
+ * Asserts that a function does not increase a numeric object property or function's return value by an amount (delta).
1107
+ *
1108
+ * T Type of object or function.
1109
+ * @param modifier function
1110
+ * @param object or getter function
1111
+ * @param property name _optional_
1112
+ * @param change amount (delta)
1113
+ */
1114
+
1115
+ increasesButNotBy: (<T>(
1116
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1117
+ modifier: Function,
1118
+ object: T,
1119
+ property: string /* keyof T */,
1120
+ change: number,
1121
+ ) => void) &
1122
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1123
+ (<T>(modifier: Function, object: T, change: number) => void);
1124
+
1125
+ /**
1126
+ * Asserts that a function decreases an object property.
1127
+ *
1128
+ * T Type of object.
1129
+ * @param modifier Function to run.
1130
+ * @param object Container object.
1131
+ * @param property Property of object expected to be decreased.
1132
+ */
1133
+ decreases: <T>(
1134
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1135
+ modifier: Function,
1136
+ object: T,
1137
+ property: string /* keyof T */,
1138
+ ) => void;
1139
+
1140
+ /**
1141
+ * Asserts that a function decreases a numeric object property or a function's return value by an amount (delta)
1142
+ *
1143
+ * T Type of object or function.
1144
+ * @param modifier function
1145
+ * @param object or getter function
1146
+ * @param property name _optional_
1147
+ * @param change amount (delta)
1148
+ */
1149
+
1150
+ decreasesBy: (<T>(
1151
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1152
+ modifier: Function,
1153
+ object: T,
1154
+ property: string /* keyof T */,
1155
+ change: number,
1156
+ ) => void) &
1157
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1158
+ (<T>(modifier: Function, object: T, change: number) => void);
1159
+
1160
+ /**
1161
+ * Asserts that a function does not decrease an object property.
1162
+ *
1163
+ * T Type of object.
1164
+ * @param modifier Function to run.
1165
+ * @param object Container object.
1166
+ * @param property Property of object expected not to be decreased.
1167
+ */
1168
+ doesNotDecrease: <T>(
1169
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1170
+ modifier: Function,
1171
+ object: T,
1172
+ property: string /* keyof T */,
1173
+ ) => void;
1174
+
1175
+ /**
1176
+ * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta)
1177
+ *
1178
+ * T Type of object or function.
1179
+ * @param modifier function
1180
+ * @param object or getter function
1181
+ * @param property name _optional_
1182
+ * @param change amount (delta)
1183
+ */
1184
+
1185
+ doesNotDecreaseBy: (<T>(
1186
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1187
+ modifier: Function,
1188
+ object: T,
1189
+ property: string /* keyof T */,
1190
+ change: number,
1191
+ ) => void) &
1192
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1193
+ (<T>(modifier: Function, object: T, change: number) => void);
1194
+
1195
+ /**
1196
+ * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta)
1197
+ *
1198
+ * T Type of object or function.
1199
+ * @param modifier function
1200
+ * @param object or getter function
1201
+ * @param property name _optional_
1202
+ * @param change amount (delta)
1203
+ */
1204
+
1205
+ decreasesButNotBy: (<T>(
1206
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1207
+ modifier: Function,
1208
+ object: T,
1209
+ property: string /* keyof T */,
1210
+ change: number,
1211
+ ) => void) &
1212
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
1213
+ (<T>(modifier: Function, object: T, change: number) => void);
1214
+
1215
+ /**
1216
+ * Asserts if value is not a false value, and throws if it is a true value.
1217
+ *
1218
+ * T Type of object.
1219
+ * @param object Actual value.
1220
+ * @remarks This is added to allow for chai to be a drop-in replacement for
1221
+ * Node’s assert class.
1222
+ */
1223
+ ifError: <T>(object: T) => void;
1224
+
1225
+ /**
1226
+ * Asserts that object is extensible (can have new properties added to it).
1227
+ *
1228
+ * T Type of object
1229
+ * @param object Actual value.
1230
+ */
1231
+ isExtensible: <T>(object: T) => void;
1232
+
1233
+ /**
1234
+ * Asserts that object is extensible (can have new properties added to it).
1235
+ *
1236
+ * T Type of object
1237
+ * @param object Actual value.
1238
+ */
1239
+ extensible: <T>(object: T) => void;
1240
+
1241
+ /**
1242
+ * Asserts that object is not extensible.
1243
+ *
1244
+ * T Type of object
1245
+ * @param object Actual value.
1246
+ */
1247
+ isNotExtensible: <T>(object: T) => void;
1248
+
1249
+ /**
1250
+ * Asserts that object is not extensible.
1251
+ *
1252
+ * T Type of object
1253
+ * @param object Actual value.
1254
+ */
1255
+ notExtensible: <T>(object: T) => void;
1256
+
1257
+ /**
1258
+ * Asserts that object is sealed (can have new properties added to it
1259
+ * and its existing properties cannot be removed).
1260
+ *
1261
+ * T Type of object
1262
+ * @param object Actual value.
1263
+ */
1264
+ isSealed: <T>(object: T) => void;
1265
+
1266
+ /**
1267
+ * Asserts that object is sealed (can have new properties added to it
1268
+ * and its existing properties cannot be removed).
1269
+ *
1270
+ * T Type of object
1271
+ * @param object Actual value.
1272
+ */
1273
+ sealed: <T>(object: T) => void;
1274
+
1275
+ /**
1276
+ * Asserts that object is not sealed.
1277
+ *
1278
+ * T Type of object
1279
+ * @param object Actual value.
1280
+ */
1281
+ isNotSealed: <T>(object: T) => void;
1282
+
1283
+ /**
1284
+ * Asserts that object is not sealed.
1285
+ *
1286
+ * T Type of object
1287
+ * @param object Actual value.
1288
+ */
1289
+ notSealed: <T>(object: T) => void;
1290
+
1291
+ /**
1292
+ * Asserts that object is frozen (cannot have new properties added to it
1293
+ * and its existing properties cannot be removed).
1294
+ *
1295
+ * T Type of object
1296
+ * @param object Actual value.
1297
+ */
1298
+ isFrozen: <T>(object: T) => void;
1299
+
1300
+ /**
1301
+ * Asserts that object is frozen (cannot have new properties added to it
1302
+ * and its existing properties cannot be removed).
1303
+ *
1304
+ * T Type of object
1305
+ * @param object Actual value.
1306
+ */
1307
+ frozen: <T>(object: T) => void;
1308
+
1309
+ /**
1310
+ * Asserts that object is not frozen (cannot have new properties added to it
1311
+ * and its existing properties cannot be removed).
1312
+ *
1313
+ * T Type of object
1314
+ * @param object Actual value.
1315
+ */
1316
+ isNotFrozen: <T>(object: T) => void;
1317
+
1318
+ /**
1319
+ * Asserts that object is not frozen (cannot have new properties added to it
1320
+ * and its existing properties cannot be removed).
1321
+ *
1322
+ * T Type of object
1323
+ * @param object Actual value.
1324
+ */
1325
+ notFrozen: <T>(object: T) => void;
1326
+
1327
+ /**
1328
+ * Asserts that the target does not contain any values. For arrays and
1329
+ * strings, it checks the length property. For Map and Set instances, it
1330
+ * checks the size property. For non-function objects, it gets the count
1331
+ * of own enumerable string keys.
1332
+ *
1333
+ * T Type of object
1334
+ * @param object Actual value.
1335
+ */
1336
+ isEmpty: <T>(object: T) => void;
1337
+
1338
+ /**
1339
+ * Asserts that the target contains values. For arrays and strings, it checks
1340
+ * the length property. For Map and Set instances, it checks the size property.
1341
+ * For non-function objects, it gets the count of own enumerable string keys.
1342
+ *
1343
+ * T Type of object.
1344
+ * @param object Object to test.
1345
+ */
1346
+ isNotEmpty: <T>(object: T) => void;
1347
+
1348
+ /**
1349
+ * Asserts that `object` has at least one of the `keys` provided.
1350
+ * You can also provide a single object instead of a `keys` array and its keys
1351
+ * will be used as the expected set of keys.
1352
+ *
1353
+ * T Type of object.
1354
+ * @param object Object to test.
1355
+ * @param keys Keys to check
1356
+ */
1357
+ hasAnyKeys: <T>(
1358
+ object: T,
1359
+ keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
1360
+ ) => void;
1361
+
1362
+ /**
1363
+ * Asserts that `object` has all and only all of the `keys` provided.
1364
+ * You can also provide a single object instead of a `keys` array and its keys
1365
+ * will be used as the expected set of keys.
1366
+ *
1367
+ * T Type of object.
1368
+ * @param object Object to test.
1369
+ * @param keys Keys to check
1370
+ */
1371
+ hasAllKeys: <T>(
1372
+ object: T,
1373
+ keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
1374
+ ) => void;
1375
+
1376
+ /**
1377
+ * Asserts that `object` has all of the `keys` provided but may have more keys not listed.
1378
+ * You can also provide a single object instead of a `keys` array and its keys
1379
+ * will be used as the expected set of keys.
1380
+ *
1381
+ * T Type of object.
1382
+ * @param object Object to test.
1383
+ * @param keys Keys to check
1384
+ */
1385
+ containsAllKeys: <T>(
1386
+ object: T,
1387
+ keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
1388
+ ) => void;
1389
+
1390
+ /**
1391
+ * Asserts that `object` has none of the `keys` provided.
1392
+ * You can also provide a single object instead of a `keys` array and its keys
1393
+ * will be used as the expected set of keys.
1394
+ *
1395
+ * T Type of object.
1396
+ * @param object Object to test.
1397
+ * @param keys Keys to check
1398
+ */
1399
+ doesNotHaveAnyKeys: <T>(
1400
+ object: T,
1401
+ keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
1402
+ ) => void;
1403
+
1404
+ /**
1405
+ * Asserts that `object` does not have at least one of the `keys` provided.
1406
+ * You can also provide a single object instead of a `keys` array and its keys
1407
+ * will be used as the expected set of keys.
1408
+ *
1409
+ * T Type of object.
1410
+ * @param object Object to test.
1411
+ * @param keys Keys to check
1412
+ */
1413
+ doesNotHaveAllKeys: <T>(
1414
+ object: T,
1415
+ keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
1416
+ ) => void;
1417
+
1418
+ /**
1419
+ * Asserts that `object` has at least one of the `keys` provided.
1420
+ * Since Sets and Maps can have objects as keys you can use this assertion to perform
1421
+ * a deep comparison.
1422
+ * You can also provide a single object instead of a `keys` array and its keys
1423
+ * will be used as the expected set of keys.
1424
+ *
1425
+ * T Type of object.
1426
+ * @param object Object to test.
1427
+ * @param keys Keys to check
1428
+ */
1429
+ hasAnyDeepKeys: <T>(
1430
+ object: T,
1431
+ keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
1432
+ ) => void;
1433
+
1434
+ /**
1435
+ * Asserts that `object` has all and only all of the `keys` provided.
1436
+ * Since Sets and Maps can have objects as keys you can use this assertion to perform
1437
+ * a deep comparison.
1438
+ * You can also provide a single object instead of a `keys` array and its keys
1439
+ * will be used as the expected set of keys.
1440
+ *
1441
+ * T Type of object.
1442
+ * @param object Object to test.
1443
+ * @param keys Keys to check
1444
+ */
1445
+ hasAllDeepKeys: <T>(
1446
+ object: T,
1447
+ keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
1448
+ ) => void;
1449
+
1450
+ /**
1451
+ * Asserts that `object` contains all of the `keys` provided.
1452
+ * Since Sets and Maps can have objects as keys you can use this assertion to perform
1453
+ * a deep comparison.
1454
+ * You can also provide a single object instead of a `keys` array and its keys
1455
+ * will be used as the expected set of keys.
1456
+ *
1457
+ * T Type of object.
1458
+ * @param object Object to test.
1459
+ * @param keys Keys to check
1460
+ */
1461
+ containsAllDeepKeys: <T>(
1462
+ object: T,
1463
+ keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
1464
+ ) => void;
1465
+
1466
+ /**
1467
+ * Asserts that `object` contains all of the `keys` provided.
1468
+ * Since Sets and Maps can have objects as keys you can use this assertion to perform
1469
+ * a deep comparison.
1470
+ * You can also provide a single object instead of a `keys` array and its keys
1471
+ * will be used as the expected set of keys.
1472
+ *
1473
+ * T Type of object.
1474
+ * @param object Object to test.
1475
+ * @param keys Keys to check
1476
+ */
1477
+ doesNotHaveAnyDeepKeys: <T>(
1478
+ object: T,
1479
+ keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
1480
+ ) => void;
1481
+
1482
+ /**
1483
+ * Asserts that `object` contains all of the `keys` provided.
1484
+ * Since Sets and Maps can have objects as keys you can use this assertion to perform
1485
+ * a deep comparison.
1486
+ * You can also provide a single object instead of a `keys` array and its keys
1487
+ * will be used as the expected set of keys.
1488
+ *
1489
+ * T Type of object.
1490
+ * @param object Object to test.
1491
+ * @param keys Keys to check
1492
+ */
1493
+ doesNotHaveAllDeepKeys: <T>(
1494
+ object: T,
1495
+ keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
1496
+ ) => void;
1497
+
1498
+ /**
1499
+ * Asserts that object has a direct or inherited property named by property,
1500
+ * which can be a string using dot- and bracket-notation for nested reference.
1501
+ *
1502
+ * T Type of object.
1503
+ * @param object Object to test.
1504
+ * @param property Property to test.
1505
+ */
1506
+ nestedProperty: <T>(object: T, property: string) => void;
1507
+
1508
+ /**
1509
+ * Asserts that object does not have a property named by property,
1510
+ * which can be a string using dot- and bracket-notation for nested reference.
1511
+ * The property cannot exist on the object nor anywhere in its prototype chain.
1512
+ *
1513
+ * T Type of object.
1514
+ * @param object Object to test.
1515
+ * @param property Property to test.
1516
+ */
1517
+ notNestedProperty: <T>(object: T, property: string) => void;
1518
+
1519
+ /**
1520
+ * Asserts that object has a property named by property with value given by value.
1521
+ * property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).
1522
+ *
1523
+ * T Type of object.
1524
+ * @param object Object to test.
1525
+ * @param property Property to test.
1526
+ * @param value Value to test.
1527
+ */
1528
+ nestedPropertyVal: <T>(object: T, property: string, value: unknown) => void;
1529
+
1530
+ /**
1531
+ * Asserts that object does not have a property named by property with value given by value.
1532
+ * property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).
1533
+ *
1534
+ * T Type of object.
1535
+ * @param object Object to test.
1536
+ * @param property Property to test.
1537
+ * @param value Value to test.
1538
+ */
1539
+ notNestedPropertyVal: <T>(
1540
+ object: T,
1541
+ property: string,
1542
+ value: unknown,
1543
+ ) => void;
1544
+
1545
+ /**
1546
+ * Asserts that object has a property named by property with a value given by value.
1547
+ * property can use dot- and bracket-notation for nested reference. Uses a deep equality check.
1548
+ *
1549
+ * T Type of object.
1550
+ * @param object Object to test.
1551
+ * @param property Property to test.
1552
+ * @param value Value to test.
1553
+ */
1554
+ deepNestedPropertyVal: <T>(
1555
+ object: T,
1556
+ property: string,
1557
+ value: unknown,
1558
+ ) => void;
1559
+
1560
+ /**
1561
+ * Asserts that object does not have a property named by property with value given by value.
1562
+ * property can use dot- and bracket-notation for nested reference. Uses a deep equality check.
1563
+ *
1564
+ * T Type of object.
1565
+ * @param object Object to test.
1566
+ * @param property Property to test.
1567
+ * @param value Value to test.
1568
+ */
1569
+ notDeepNestedPropertyVal: <T>(
1570
+ object: T,
1571
+ property: string,
1572
+ value: unknown,
1573
+ ) => void;
1574
+ }>;