/* eslint-disable @typescript-eslint/no-unsafe-function-type */ /* eslint-disable @typescript-eslint/no-restricted-types */ /* eslint-disable @typescript-eslint/consistent-type-imports */ // Copied from https://github.com/vitest-dev/vitest/blob/v4.0.14/packages/vitest/globals.d.ts and replaced `assert` declare global { const assert: OverriddenAssert; const suite: (typeof import('vitest'))['suite']; const test: (typeof import('vitest'))['test']; const chai: (typeof import('vitest'))['chai']; const describe: (typeof import('vitest'))['describe']; const it: (typeof import('vitest'))['it']; const expectTypeOf: (typeof import('vitest'))['expectTypeOf']; const assertType: (typeof import('vitest'))['assertType']; const expect: (typeof import('vitest'))['expect']; const vitest: (typeof import('vitest'))['vitest']; const vi: (typeof import('vitest'))['vitest']; const beforeAll: (typeof import('vitest'))['beforeAll']; const afterAll: (typeof import('vitest'))['afterAll']; const beforeEach: (typeof import('vitest'))['beforeEach']; const afterEach: (typeof import('vitest'))['afterEach']; const onTestFailed: (typeof import('vitest'))['onTestFailed']; const onTestFinished: (typeof import('vitest'))['onTestFinished']; } export {}; type Constructor = Chai.Constructor; type Operator = Chai.Operator; type OperatorComparable = Chai.OperatorComparable; type OverriddenAssert = Readonly<{ /** * Asserts that value is true. * * @param value Actual value. */ isTrue: (value: boolean) => asserts value; /** * Asserts that value is false. * * @param value Actual value. */ isFalse: (value: boolean) => asserts value is false; // ModifiedChai.Assert // // - Removed optional `message` arg // - Convert arg types to be readonly // - Replace `Object` with `object` // - Removed the call signature // - Removed deepEqual, equal, notEqual, ok, notOk, isOk, isNotOk, isTrue, isFalse // - deepEqual // Removed in favor of assert.deepStrictEqual // - equal // Removed in favor of assert.strictEqual // - notEqual // Removed in favor of assert.notStrictEqual // - ok // Removed in favor of assert.isTrue // - notOk // Removed in favor of assert.isFalse // - isOk // Removed in favor of assert.isTrue // - isNotOk // Removed in favor of assert.isFalse // - isTrue // Overridden with OverriddenAssert // - isFalse // Overridden with OverriddenAssert // /** // * @param expression Expression to test for truthiness. // */ // (expression: unknown): asserts expression; /** * Throws a failure. * * @remarks Node.js assert module-compatible. */ fail: (() => never) & ((actual: T, expected: T, operator?: Operator) => never); // /** // * Asserts that object is truthy. // * // * @param object Object to test. // */ // isOk: (value: unknown) => asserts value; // /** // * Asserts that object is truthy. // * // * @param object Object to test. // */ // ok: (value: unknown) => asserts value; // /** // * Asserts that object is falsy. // * // * T Type of object. // * @param object Object to test. // */ // isNotOk: (value: T) => void; // /** // * Asserts that object is falsy. // * // * T Type of object. // * @param object Object to test. // */ // notOk: (value: T) => void; // /** // * Asserts non-strict equality (==) of actual and expected. // * // * T Type of the objects. // * @param actual Actual value. // * @param expected Potential expected value. // */ // equal: (actual: T, expected: T) => void; // /** // * Asserts non-strict inequality (!=) of actual and expected. // * // * T Type of the objects. // * @param actual Actual value. // * @param expected Potential expected value. // */ // notEqual: (actual: T, expected: T) => void; /** * Asserts strict equality (===) of actual and expected. * * T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. */ strictEqual: (actual: T, expected: T) => void; /** * Asserts strict inequality (!==) of actual and expected. * * T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. */ notStrictEqual: (actual: T, expected: T) => void; // /** // * Asserts that actual is deeply equal to expected. // * // * T Type of the objects. // * @param actual Actual value. // * @param expected Potential expected value. // */ // deepEqual: (actual: T, expected: T) => void; /** * Asserts that actual is not deeply equal to expected. * * T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. */ notDeepEqual: (actual: T, expected: T) => void; /** * Alias to deepEqual * * T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. */ deepStrictEqual: (actual: T, expected: T) => void; /** * Partially matches actual and expected. * * @param actual Actual value. * @param expected Potential subset of the value. */ containSubset: (val: unknown, exp: unknown, msg?: string) => void; /** * Partially matches actual and expected. * * @param actual Actual value. * @param expected Potential subset of the value. */ containsSubset: (val: unknown, exp: unknown, msg?: string) => void; /** * No partial match between actual and expected exists. * * @param actual Actual value. * @param expected Potential subset of the value. */ doesNotContainSubset: (val: unknown, exp: unknown, msg?: string) => void; /** * Asserts valueToCheck is strictly greater than (>) valueToBeAbove. * * @param valueToCheck Actual value. * @param valueToBeAbove Minimum Potential expected value. */ isAbove: (valueToCheck: number, valueToBeAbove: number) => void; /** * Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast. * * @param valueToCheck Actual value. * @param valueToBeAtLeast Minimum Potential expected value. */ isAtLeast: (valueToCheck: number, valueToBeAtLeast: number) => void; /** * Asserts valueToCheck is strictly less than (<) valueToBeBelow. * * @param valueToCheck Actual value. * @param valueToBeBelow Minimum Potential expected value. */ isBelow: (valueToCheck: number, valueToBeBelow: number) => void; /** * Asserts valueToCheck is less than or equal to (<=) valueToBeAtMost. * * @param valueToCheck Actual value. * @param valueToBeAtMost Minimum Potential expected value. */ isAtMost: (valueToCheck: number, valueToBeAtMost: number) => void; // /** // * Asserts that value is true. // * // * @param value Actual value. // */ // isTrue: (value: unknown) => asserts value is true; // /** // * Asserts that value is false. // * // * @param value Actual value. // */ // isFalse: (value: unknown) => asserts value is false; /** * Asserts that value is not true. * * T Type of value. * @param value Actual value. */ isNotTrue: (value: T) => asserts value is Exclude; /** * Asserts that value is not false. * * @param value Actual value. */ isNotFalse: (value: T) => asserts value is Exclude; /** * Asserts that value is null. * * @param value Actual value. */ isNull: (value: unknown) => asserts value is null; /** * Asserts that value is not null. * * T Type of value. * @param value Actual value. */ isNotNull: (value: T) => asserts value is Exclude; /** * Asserts that value is NaN. * * T Type of value. * @param value Actual value. */ isNaN: (value: T) => void; /** * Asserts that value is not NaN. * * T Type of value. * @param value Actual value. */ isNotNaN: (value: T) => void; /** * Asserts that the target is neither null nor undefined. * * T Type of value. * @param value Actual value. */ exists: (value: T) => asserts value is NonNullable; /** * Asserts that the target is either null or undefined. * * @param value Actual value. */ notExists: (value: unknown) => asserts value is null | undefined; /** * Asserts that value is undefined. * * @param value Actual value. */ isUndefined: (value: unknown) => asserts value is undefined; /** * Asserts that value is not undefined. * * T Type of value. * @param value Actual value. */ isDefined: (value: T) => asserts value is Exclude; /** * Asserts that value is a function. * * T Type of value. * @param value Actual value. */ isFunction: (value: T) => void; /** * Asserts that value is not a function. * * T Type of value. * @param value Actual value. */ isNotFunction: (value: T) => void; /** * Asserts that value is an object of type 'Object' * (as revealed by Object.prototype.toString). * * T Type of value. * @param value Actual value. * @remarks The assertion does not match subclassed objects. */ isObject: (value: T) => void; /** * Asserts that value is not an object of type 'Object' * (as revealed by Object.prototype.toString). * * T Type of value. * @param value Actual value. */ isNotObject: (value: T) => void; /** * Asserts that value is an array. * * T Type of value. * @param value Actual value. */ isArray: (value: T) => void; /** * Asserts that value is not an array. * * T Type of value. * @param value Actual value. */ isNotArray: (value: T) => void; /** * Asserts that value is a string. * * T Type of value. * @param value Actual value. */ isString: (value: T) => void; /** * Asserts that value is not a string. * * T Type of value. * @param value Actual value. */ isNotString: (value: T) => void; /** * Asserts that value is a number. * * T Type of value. * @param value Actual value. */ isNumber: (value: T) => void; /** * Asserts that value is not a number. * * T Type of value. * @param value Actual value. */ isNotNumber: (value: T) => void; /** * Asserts that value is a finite number. * Unlike `.isNumber`, this will fail for `NaN` and `Infinity`. * * T Type of value * @param value Actual value */ isFinite: (value: T) => void; /** * Asserts that value is a boolean. * * T Type of value. * @param value Actual value. */ isBoolean: (value: T) => void; /** * Asserts that value is not a boolean. * * T Type of value. * @param value Actual value. */ isNotBoolean: (value: T) => void; /** * Asserts that value's type is name, as determined by Object.prototype.toString. * * T Type of value. * @param value Actual value. * @param name Potential expected type name of value. */ typeOf: (value: T, name: string) => void; /** * Asserts that value's type is not name, as determined by Object.prototype.toString. * * T Type of value. * @param value Actual value. * @param name Potential expected type name of value. */ notTypeOf: (value: T, name: string) => void; /** * Asserts that value is an instance of constructor. * * T Expected type of value. * @param value Actual value. * @param ctor Potential expected constructor of value. */ instanceOf: (value: unknown, ctor: Constructor) => asserts value is T; /** * Asserts that value is not an instance of constructor. * * T Type of value. * U Type that value shouldn't be an instance of. * @param value Actual value. * @param ctor Potential expected constructor of value. */ notInstanceOf: ( value: T, ctor: Constructor, ) => asserts value is Exclude; /** * Asserts that haystack includes needle. * * @param haystack Container string. * @param needle Potential substring of haystack. */ include: ((haystack: string, needle: string) => void) & (( // eslint-disable-next-line @typescript-eslint/no-explicit-any haystack: readonly T[] | ReadonlySet | ReadonlyMap, needle: T, ) => void) & ((haystack: WeakSet, needle: T) => void) & ((haystack: T, needle: Partial) => void); /** * Asserts that haystack does not include needle. * * @param haystack Container string. * @param needle Potential substring of haystack. */ notInclude: ((haystack: string, needle: string) => void) & (( // eslint-disable-next-line @typescript-eslint/no-explicit-any haystack: readonly T[] | ReadonlySet | ReadonlyMap, needle: T, ) => void) & ((haystack: WeakSet, needle: T) => void) & ((haystack: T, needle: Partial) => void); /** * Asserts that haystack includes needle. Deep equality is used. * * @param haystack Container string. * @param needle Potential substring of haystack. * * @deprecated Does not have any effect on string. Use {@link Assert#include} instead. */ deepInclude: ((haystack: string, needle: string) => void) & (( // eslint-disable-next-line @typescript-eslint/no-explicit-any haystack: readonly T[] | ReadonlySet | ReadonlyMap, needle: T, ) => void) & (( haystack: T, // eslint-disable-next-line @typescript-eslint/no-explicit-any needle: T extends WeakSet ? never : Partial, ) => void); /** * Asserts that haystack does not include needle. Deep equality is used. * * @param haystack Container string. * @param needle Potential substring of haystack. * * @deprecated Does not have any effect on string. Use {@link Assert#notInclude} instead. */ notDeepInclude: ((haystack: string, needle: string) => void) & (( // eslint-disable-next-line @typescript-eslint/no-explicit-any haystack: readonly T[] | ReadonlySet | ReadonlyMap, needle: T, ) => void) & (( haystack: T, // eslint-disable-next-line @typescript-eslint/no-explicit-any needle: T extends WeakSet ? never : Partial, ) => void); /** * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object. * * Enables the use of dot- and bracket-notation for referencing nested properties. * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. * Can be used to assert the inclusion of a subset of properties in an object. * Enables the use of dot- and bracket-notation for referencing nested properties. * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. * * @param haystack * @param needle */ nestedInclude: (haystack: unknown, needle: unknown) => void; /** * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object. * * Enables the use of dot- and bracket-notation for referencing nested properties. * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. * Can be used to assert the inclusion of a subset of properties in an object. * Enables the use of dot- and bracket-notation for referencing nested properties. * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. * * @param haystack * @param needle */ notNestedInclude: (haystack: unknown, needle: unknown) => void; /** * 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 * * Enables the use of dot- and bracket-notation for referencing nested properties. * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. * Can be used to assert the inclusion of a subset of properties in an object. * Enables the use of dot- and bracket-notation for referencing nested properties. * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. * * @param haystack * @param needle */ deepNestedInclude: (haystack: unknown, needle: unknown) => void; /** * 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. * * Enables the use of dot- and bracket-notation for referencing nested properties. * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. * Can be used to assert the inclusion of a subset of properties in an object. * Enables the use of dot- and bracket-notation for referencing nested properties. * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. * * @param haystack * @param needle */ notDeepNestedInclude: (haystack: unknown, needle: unknown) => void; /** * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties. * * @param haystack * @param needle */ ownInclude: (haystack: unknown, needle: unknown) => void; /** * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties. * * @param haystack * @param needle */ notOwnInclude: (haystack: unknown, needle: unknown) => void; /** * 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 * * @param haystack * @param needle */ deepOwnInclude: (haystack: unknown, needle: unknown) => void; /** * 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. * * @param haystack * @param needle */ notDeepOwnInclude: (haystack: unknown, needle: unknown) => void; /** * Asserts that value matches the regular expression regexp. * * @param value Actual value. * @param regexp Potential match of value. */ match: (value: string, regexp: RegExp) => void; /** * Asserts that value does not match the regular expression regexp. * * @param value Actual value. * @param regexp Potential match of value. */ notMatch: (expected: unknown, regexp: RegExp) => void; /** * Asserts that object has a property named by property. * * T Type of object. * @param object Container object. * @param property Potential contained property of object. */ property: (object: T, property: string /* keyof T */) => void; /** * Asserts that object does not have a property named by property. * * T Type of object. * @param object Container object. * @param property Potential contained property of object. */ notProperty: (object: T, property: string /* keyof T */) => void; /** * Asserts that object has a property named by property, which can be a string * using dot- and bracket-notation for deep reference. * * T Type of object. * @param object Container object. * @param property Potential contained property of object. */ deepProperty: (object: T, property: string) => void; /** * Asserts that object does not have a property named by property, which can be a * string using dot- and bracket-notation for deep reference. * * T Type of object. * @param object Container object. * @param property Potential contained property of object. */ notDeepProperty: (object: T, property: string) => void; /** * Asserts that object has a property named by property with value given by value. * * T Type of object. * V Type of value. * @param object Container object. * @param property Potential contained property of object. * @param value Potential expected property value. */ propertyVal: ( object: T, property: string /* keyof T */, value: V, ) => void; /** * Asserts that object has a property named by property with value given by value. * * T Type of object. * V Type of value. * @param object Container object. * @param property Potential contained property of object. * @param value Potential expected property value. */ notPropertyVal: ( object: T, property: string /* keyof T */, value: V, ) => void; /** * Asserts that object has a property named by property, which can be a string * using dot- and bracket-notation for deep reference. * * T Type of object. * V Type of value. * @param object Container object. * @param property Potential contained property of object. * @param value Potential expected property value. */ deepPropertyVal: (object: T, property: string, value: V) => void; /** * Asserts that object does not have a property named by property, which can be a * string using dot- and bracket-notation for deep reference. * * T Type of object. * V Type of value. * @param object Container object. * @param property Potential contained property of object. * @param value Potential expected property value. */ notDeepPropertyVal: (object: T, property: string, value: V) => void; /** * Asserts that object has a length property with the expected value. * * T Type of object. * @param object Container object. * @param length Potential expected length of object. */ lengthOf: < T extends | Readonly<{ length?: number | undefined }> | Readonly<{ size?: number | undefined }>, >( object: T, length: number, ) => void; /** * Asserts that fn will throw an error. * * @param fn Function that may throw. * @param errMsgMatcher Expected error message matcher. * @param ignored Ignored parameter. */ throw: (( fn: () => void, errMsgMatcher?: RegExp | string, ignored?: unknown, ) => void) & (( fn: () => void, // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types errorLike?: ErrorConstructor | Error | null, errMsgMatcher?: RegExp | string | null, ) => void); /** * Asserts that fn will throw an error. * * @param fn Function that may throw. * @param errMsgMatcher Expected error message matcher. * @param ignored Ignored parameter. */ throws: (( fn: () => void, errMsgMatcher?: RegExp | string, ignored?: unknown, ) => void) & (( fn: () => void, // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types errorLike?: ErrorConstructor | Error | null, errMsgMatcher?: RegExp | string | null, ) => void); /** * Asserts that fn will throw an error. * * @param fn Function that may throw. * @param errMsgMatcher Expected error message matcher. * @param ignored Ignored parameter. */ Throw: (( fn: () => void, errMsgMatcher?: RegExp | string, ignored?: unknown, ) => void) & (( fn: () => void, // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types errorLike?: ErrorConstructor | Error | null, errMsgMatcher?: RegExp | string | null, ) => void); /** * Asserts that fn will not throw an error. * * @param fn Function that may throw. * @param errMsgMatcher Expected error message matcher. * @param ignored Ignored parameter. */ doesNotThrow: (( fn: () => void, errMsgMatcher?: RegExp | string, ignored?: unknown, ) => void) & (( fn: () => void, // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types errorLike?: ErrorConstructor | Error | null, errMsgMatcher?: RegExp | string | null, ) => void); /** * Compares two values using operator. * * @param val1 Left value during comparison. * @param operator Comparison operator. * @param val2 Right value during comparison. */ operator: ( val1: OperatorComparable, operator: Operator, val2: OperatorComparable, ) => void; /** * Asserts that the target is equal to expected, to within a +/- delta range. * * @param actual Actual value * @param expected Potential expected value. * @param delta Maximum difference between values. */ closeTo: (actual: number, expected: number, delta: number) => void; /** * Asserts that the target is equal to expected, to within a +/- delta range. * * @param actual Actual value * @param expected Potential expected value. * @param delta Maximum difference between values. */ approximately: (act: number, exp: number, delta: number) => void; /** * Asserts that set1 and set2 have the same members. Order is not take into account. * * T Type of set values. * @param set1 Actual set of values. * @param set2 Potential expected set of values. */ sameMembers: (set1: readonly T[], set2: readonly T[]) => void; /** * Asserts that set1 and set2 have the same members using deep equality checking. * Order is not take into account. * * T Type of set values. * @param set1 Actual set of values. * @param set2 Potential expected set of values. */ sameDeepMembers: (set1: readonly T[], set2: readonly T[]) => void; /** * Asserts that `set1` and `set2` don't have the same members in any order. * Uses a deep equality check. * * T Type of set values. * @param set1 * @param set2 */ notSameDeepMembers: (set1: readonly T[], set2: readonly T[]) => void; /** * Asserts that set1 and set2 have the same members in the same order. * Uses a strict equality check (===). * * T Type of set values. * @param set1 Actual set of values. * @param set2 Potential expected set of values. */ sameOrderedMembers: (set1: readonly T[], set2: readonly T[]) => void; /** * Asserts that set1 and set2 don’t have the same members in the same order. * Uses a strict equality check (===). * * T Type of set values. * @param set1 Actual set of values. * @param set2 Potential expected set of values. */ notSameOrderedMembers: (set1: readonly T[], set2: readonly T[]) => void; /** * Asserts that set1 and set2 have the same members in the same order. * Uses a deep equality check. * * T Type of set values. * @param set1 Actual set of values. * @param set2 Potential expected set of values. */ sameDeepOrderedMembers: (set1: readonly T[], set2: readonly T[]) => void; /** * Asserts that set1 and set2 don’t have the same members in the same order. * Uses a deep equality check. * * T Type of set values. * @param set1 Actual set of values. * @param set2 Potential expected set of values. */ notSameDeepOrderedMembers: ( set1: readonly T[], set2: readonly T[], ) => void; /** * Asserts that subset is included in superset in the same order beginning with the first element in superset. * Uses a strict equality check (===). * * T Type of set values. * @param superset Actual set of values. * @param subset Potential contained set of values. */ includeOrderedMembers: ( superset: readonly T[], subset: readonly T[], ) => void; /** * Asserts that subset isn’t included in superset in the same order beginning with the first element in superset. * Uses a strict equality check (===). * * T Type of set values. * @param superset Actual set of values. * @param subset Potential contained set of values. */ notIncludeOrderedMembers: ( superset: readonly T[], subset: readonly T[], ) => void; /** * Asserts that subset is included in superset in the same order beginning with the first element in superset. * Uses a deep equality check. * * T Type of set values. * @param superset Actual set of values. * @param subset Potential contained set of values. */ includeDeepOrderedMembers: ( superset: readonly T[], subset: readonly T[], ) => void; /** * Asserts that subset isn’t included in superset in the same order beginning with the first element in superset. * Uses a deep equality check. * * T Type of set values. * @param superset Actual set of values. * @param subset Potential contained set of values. */ notIncludeDeepOrderedMembers: ( superset: readonly T[], subset: readonly T[], ) => void; /** * Asserts that subset is included in superset. Order is not take into account. * * T Type of set values. * @param superset Actual set of values. * @param subset Potential contained set of values. */ includeMembers: (superset: readonly T[], subset: readonly T[]) => void; /** * Asserts that subset isn’t included in superset in any order. * Uses a strict equality check (===). Duplicates are ignored. * * T Type of set values. * @param superset Actual set of values. * @param subset Potential not contained set of values. */ notIncludeMembers: (superset: readonly T[], subset: readonly T[]) => void; /** * Asserts that subset is included in superset using deep equality checking. * Order is not take into account. * * T Type of set values. * @param superset Actual set of values. * @param subset Potential contained set of values. */ includeDeepMembers: (superset: readonly T[], subset: readonly T[]) => void; /** * Asserts that `subset` isn't included in `superset` in any order. Uses a * deep equality check. Duplicates are ignored. * * assert.notIncludeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { f: 5 } ], 'not include deep members'); * * T Type of set values. * @param superset Actual set of values. * @param subset Potential contained set of values. */ notIncludeDeepMembers: ( superset: readonly T[], subset: readonly T[], ) => void; /** * Asserts that non-object, non-array value inList appears in the flat array list. * * T Type of list values. * @param inList Value expected to be in the list. * @param list List of values. */ oneOf: (inList: T, list: readonly T[]) => void; /** * Asserts that a function changes the value of a property. * * T Type of object. * @param modifier Function to run. * @param object Container object. * @param property Property of object expected to be modified. */ changes: ( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types modifier: Function, object: T, property: string /* keyof T */, ) => void; /** * Asserts that a function changes the value of a property by an amount (delta). * * @param modifier function * @param object or getter function * @param property name _optional_ * @param change amount (delta) */ changesBy: (( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types modifier: Function, object: T, property: string /* keyof T */, change: number, ) => void) & // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types ((modifier: Function, object: T, change: number) => void); /** * Asserts that a function does not change the value of a property. * * T Type of object. * @param modifier Function to run. * @param object Container object. * @param property Property of object expected not to be modified. */ doesNotChange: ( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types modifier: Function, object: T, property: string /* keyof T */, ) => void; /** * Asserts that a function increases an object property. * * T Type of object. * @param modifier Function to run. * @param object Container object. * @param property Property of object expected to be increased. */ increases: ( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types modifier: Function, object: T, property: string /* keyof T */, ) => void; /** * Asserts that a function increases a numeric object property or a function's return value by an amount (delta). * * T Type of object or function. * @param modifier function * @param object or getter function * @param property name _optional_ * @param change amount (delta) */ increasesBy: (( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types modifier: Function, object: T, property: string /* keyof T */, change: number, ) => void) & // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types ((modifier: Function, object: T, change: number) => void); /** * Asserts that a function does not increase an object property. * * T Type of object. * @param modifier Function to run. * @param object Container object. * @param property Property of object expected not to be increased. */ doesNotIncrease: ( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types modifier: Function, object: T, property: string /* keyof T */, ) => void; /** * Asserts that a function does not increase a numeric object property or function's return value by an amount (delta). * * T Type of object or function. * @param modifier function * @param object or getter function * @param property name _optional_ * @param change amount (delta) */ increasesButNotBy: (( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types modifier: Function, object: T, property: string /* keyof T */, change: number, ) => void) & // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types ((modifier: Function, object: T, change: number) => void); /** * Asserts that a function decreases an object property. * * T Type of object. * @param modifier Function to run. * @param object Container object. * @param property Property of object expected to be decreased. */ decreases: ( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types modifier: Function, object: T, property: string /* keyof T */, ) => void; /** * Asserts that a function decreases a numeric object property or a function's return value by an amount (delta) * * T Type of object or function. * @param modifier function * @param object or getter function * @param property name _optional_ * @param change amount (delta) */ decreasesBy: (( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types modifier: Function, object: T, property: string /* keyof T */, change: number, ) => void) & // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types ((modifier: Function, object: T, change: number) => void); /** * Asserts that a function does not decrease an object property. * * T Type of object. * @param modifier Function to run. * @param object Container object. * @param property Property of object expected not to be decreased. */ doesNotDecrease: ( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types modifier: Function, object: T, property: string /* keyof T */, ) => void; /** * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta) * * T Type of object or function. * @param modifier function * @param object or getter function * @param property name _optional_ * @param change amount (delta) */ doesNotDecreaseBy: (( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types modifier: Function, object: T, property: string /* keyof T */, change: number, ) => void) & // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types ((modifier: Function, object: T, change: number) => void); /** * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta) * * T Type of object or function. * @param modifier function * @param object or getter function * @param property name _optional_ * @param change amount (delta) */ decreasesButNotBy: (( // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types modifier: Function, object: T, property: string /* keyof T */, change: number, ) => void) & // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types ((modifier: Function, object: T, change: number) => void); /** * Asserts if value is not a false value, and throws if it is a true value. * * T Type of object. * @param object Actual value. * @remarks This is added to allow for chai to be a drop-in replacement for * Node’s assert class. */ ifError: (object: T) => void; /** * Asserts that object is extensible (can have new properties added to it). * * T Type of object * @param object Actual value. */ isExtensible: (object: T) => void; /** * Asserts that object is extensible (can have new properties added to it). * * T Type of object * @param object Actual value. */ extensible: (object: T) => void; /** * Asserts that object is not extensible. * * T Type of object * @param object Actual value. */ isNotExtensible: (object: T) => void; /** * Asserts that object is not extensible. * * T Type of object * @param object Actual value. */ notExtensible: (object: T) => void; /** * Asserts that object is sealed (can have new properties added to it * and its existing properties cannot be removed). * * T Type of object * @param object Actual value. */ isSealed: (object: T) => void; /** * Asserts that object is sealed (can have new properties added to it * and its existing properties cannot be removed). * * T Type of object * @param object Actual value. */ sealed: (object: T) => void; /** * Asserts that object is not sealed. * * T Type of object * @param object Actual value. */ isNotSealed: (object: T) => void; /** * Asserts that object is not sealed. * * T Type of object * @param object Actual value. */ notSealed: (object: T) => void; /** * Asserts that object is frozen (cannot have new properties added to it * and its existing properties cannot be removed). * * T Type of object * @param object Actual value. */ isFrozen: (object: T) => void; /** * Asserts that object is frozen (cannot have new properties added to it * and its existing properties cannot be removed). * * T Type of object * @param object Actual value. */ frozen: (object: T) => void; /** * Asserts that object is not frozen (cannot have new properties added to it * and its existing properties cannot be removed). * * T Type of object * @param object Actual value. */ isNotFrozen: (object: T) => void; /** * Asserts that object is not frozen (cannot have new properties added to it * and its existing properties cannot be removed). * * T Type of object * @param object Actual value. */ notFrozen: (object: T) => void; /** * Asserts that the target does not contain any values. For arrays and * strings, it checks the length property. For Map and Set instances, it * checks the size property. For non-function objects, it gets the count * of own enumerable string keys. * * T Type of object * @param object Actual value. */ isEmpty: (object: T) => void; /** * Asserts that the target contains values. For arrays and strings, it checks * the length property. For Map and Set instances, it checks the size property. * For non-function objects, it gets the count of own enumerable string keys. * * T Type of object. * @param object Object to test. */ isNotEmpty: (object: T) => void; /** * Asserts that `object` has at least one of the `keys` provided. * You can also provide a single object instead of a `keys` array and its keys * will be used as the expected set of keys. * * T Type of object. * @param object Object to test. * @param keys Keys to check */ hasAnyKeys: ( object: T, keys: readonly (object | string)[] | Readonly>, ) => void; /** * Asserts that `object` has all and only all of the `keys` provided. * You can also provide a single object instead of a `keys` array and its keys * will be used as the expected set of keys. * * T Type of object. * @param object Object to test. * @param keys Keys to check */ hasAllKeys: ( object: T, keys: readonly (object | string)[] | Readonly>, ) => void; /** * Asserts that `object` has all of the `keys` provided but may have more keys not listed. * You can also provide a single object instead of a `keys` array and its keys * will be used as the expected set of keys. * * T Type of object. * @param object Object to test. * @param keys Keys to check */ containsAllKeys: ( object: T, keys: readonly (object | string)[] | Readonly>, ) => void; /** * Asserts that `object` has none of the `keys` provided. * You can also provide a single object instead of a `keys` array and its keys * will be used as the expected set of keys. * * T Type of object. * @param object Object to test. * @param keys Keys to check */ doesNotHaveAnyKeys: ( object: T, keys: readonly (object | string)[] | Readonly>, ) => void; /** * Asserts that `object` does not have at least one of the `keys` provided. * You can also provide a single object instead of a `keys` array and its keys * will be used as the expected set of keys. * * T Type of object. * @param object Object to test. * @param keys Keys to check */ doesNotHaveAllKeys: ( object: T, keys: readonly (object | string)[] | Readonly>, ) => void; /** * Asserts that `object` has at least one of the `keys` provided. * Since Sets and Maps can have objects as keys you can use this assertion to perform * a deep comparison. * You can also provide a single object instead of a `keys` array and its keys * will be used as the expected set of keys. * * T Type of object. * @param object Object to test. * @param keys Keys to check */ hasAnyDeepKeys: ( object: T, keys: readonly (object | string)[] | Readonly>, ) => void; /** * Asserts that `object` has all and only all of the `keys` provided. * Since Sets and Maps can have objects as keys you can use this assertion to perform * a deep comparison. * You can also provide a single object instead of a `keys` array and its keys * will be used as the expected set of keys. * * T Type of object. * @param object Object to test. * @param keys Keys to check */ hasAllDeepKeys: ( object: T, keys: readonly (object | string)[] | Readonly>, ) => void; /** * Asserts that `object` contains all of the `keys` provided. * Since Sets and Maps can have objects as keys you can use this assertion to perform * a deep comparison. * You can also provide a single object instead of a `keys` array and its keys * will be used as the expected set of keys. * * T Type of object. * @param object Object to test. * @param keys Keys to check */ containsAllDeepKeys: ( object: T, keys: readonly (object | string)[] | Readonly>, ) => void; /** * Asserts that `object` contains all of the `keys` provided. * Since Sets and Maps can have objects as keys you can use this assertion to perform * a deep comparison. * You can also provide a single object instead of a `keys` array and its keys * will be used as the expected set of keys. * * T Type of object. * @param object Object to test. * @param keys Keys to check */ doesNotHaveAnyDeepKeys: ( object: T, keys: readonly (object | string)[] | Readonly>, ) => void; /** * Asserts that `object` contains all of the `keys` provided. * Since Sets and Maps can have objects as keys you can use this assertion to perform * a deep comparison. * You can also provide a single object instead of a `keys` array and its keys * will be used as the expected set of keys. * * T Type of object. * @param object Object to test. * @param keys Keys to check */ doesNotHaveAllDeepKeys: ( object: T, keys: readonly (object | string)[] | Readonly>, ) => void; /** * Asserts that object has a direct or inherited property named by property, * which can be a string using dot- and bracket-notation for nested reference. * * T Type of object. * @param object Object to test. * @param property Property to test. */ nestedProperty: (object: T, property: string) => void; /** * Asserts that object does not have a property named by property, * which can be a string using dot- and bracket-notation for nested reference. * The property cannot exist on the object nor anywhere in its prototype chain. * * T Type of object. * @param object Object to test. * @param property Property to test. */ notNestedProperty: (object: T, property: string) => void; /** * Asserts that object has a property named by property with value given by value. * property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===). * * T Type of object. * @param object Object to test. * @param property Property to test. * @param value Value to test. */ nestedPropertyVal: (object: T, property: string, value: unknown) => void; /** * Asserts that object does not have a property named by property with value given by value. * property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===). * * T Type of object. * @param object Object to test. * @param property Property to test. * @param value Value to test. */ notNestedPropertyVal: ( object: T, property: string, value: unknown, ) => void; /** * Asserts that object has a property named by property with a value given by value. * property can use dot- and bracket-notation for nested reference. Uses a deep equality check. * * T Type of object. * @param object Object to test. * @param property Property to test. * @param value Value to test. */ deepNestedPropertyVal: ( object: T, property: string, value: unknown, ) => void; /** * Asserts that object does not have a property named by property with value given by value. * property can use dot- and bracket-notation for nested reference. Uses a deep equality check. * * T Type of object. * @param object Object to test. * @param property Property to test. * @param value Value to test. */ notDeepNestedPropertyVal: ( object: T, property: string, value: unknown, ) => void; }>;