• Parameters

    • expression: any

      Expression to test for truthiness.

    • Optional message: string

      Message to display on error.

    Returns asserts expression

Methods

Throw approximately changes closeTo containSubset containsAllDeepKeys containsAllKeys decreases deepEqual deepInclude deepNestedInclude deepNestedPropertyVal deepOwnInclude deepProperty deepPropertyVal deepStrictEqual doesNotChange doesNotDecrease doesNotHaveAllDeepKeys doesNotHaveAllKeys doesNotHaveAnyDeepKeys doesNotHaveAnyKeys doesNotIncrease doesNotThrow equal exists extensible fail frozen hasAllDeepKeys hasAllKeys hasAnyDeepKeys hasAnyKeys ifError include includeDeepMembers includeDeepOrderedMembers includeMembers includeOrderedMembers increases instanceOf isAbove isArray isAtLeast isAtMost isBelow isBoolean isDefined isEmpty isExtensible isFalse isFinite isFrozen isFunction isNaN isNotArray isNotBoolean isNotEmpty isNotExtensible isNotFalse isNotFrozen isNotFunction isNotNaN isNotNull isNotNumber isNotObject isNotOk isNotSealed isNotString isNotTrue isNull isNumber isObject isOk isSealed isString isTrue isUndefined lengthOf match nestedInclude nestedProperty nestedPropertyVal notDeepEqual notDeepInclude notDeepNestedInclude notDeepNestedPropertyVal notDeepOwnInclude notDeepProperty notDeepPropertyVal notEqual notExists notExtensible notFrozen notInclude notIncludeDeepOrderedMembers notIncludeMembers notIncludeOrderedMembers notInstanceOf notMatch notNestedInclude notNestedProperty notNestedPropertyVal notOk notOwnInclude notProperty notPropertyVal notSameDeepOrderedMembers notSameOrderedMembers notSealed notStrictEqual notTypeOf ok oneOf operator ownInclude property propertyVal sameDeepMembers sameDeepOrderedMembers sameMembers sameOrderedMembers sealed strictEqual throw throws typeOf

Methods

  • Asserts that fn will throw an error.

    Parameters

    • fn: (() => void)

      Function that may throw.

        • (): void
        • Returns void

    • Optional errMsgMatcher: string | RegExp

      Expected error message matcher.

    • Optional ignored: any

      Ignored parameter.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that fn will throw an error.

    Parameters

    • fn: (() => void)

      Function that may throw.

        • (): void
        • Returns void

    • Optional errorLike: null | Error | ErrorConstructor

      Expected error constructor or error instance.

    • Optional errMsgMatcher: null | string | RegExp

      Expected error message matcher.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that the target is equal to expected, to within a +/- delta range.

    Parameters

    • act: number
    • exp: number
    • delta: number

      Maximum differenced between values.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that a function changes the value of a property.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • modifier: Function

      Function to run.

    • object: T

      Container object.

    • property: string

      Property of object expected to be modified.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that the target is equal to expected, to within a +/- delta range.

    Parameters

    • actual: number

      Actual value

    • expected: number

      Potential expected value.

    • delta: number

      Maximum differenced between values.

    • Optional message: string

      Message to display on error.

    Returns void

  • Parameters

    • val: any
    • exp: any
    • Optional msg: string

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {
          [key: string]: any;
      }

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {
          [key: string]: any;
      }

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that a function decreases an object property.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • modifier: Function

      Function to run.

    • object: T

      Container object.

    • property: string

      Property of object expected to be decreased.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that actual is deeply equal to expected.

    T Type of the objects.

    Type Parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack includes needle. Deep equality is used.

    Parameters

    • haystack: string

      Container string.

    • needle: string

      Potential substring of haystack.

    • Optional message: string

      Message to display on error.

    Returns void

    Deprecated

    Does not have any effect on string. Use Assert#include instead.

  • Asserts that haystack includes needle. Deep equality is used.

    T Type of values in haystack.

    Type Parameters

    • T

    Parameters

    • haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>

      Container array, set or map.

    • needle: T

      Potential value contained in haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle.

    T Type of haystack.

    Type Parameters

    • T

    Parameters

    • haystack: T

      Object.

    • needle: T extends WeakSet<any>
          ? never
          : Partial<T>

      Potential subset of the haystack's properties.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • property: string

      Property to test.

    • value: any

      Value to test.

    • Optional message: string

      Message to display on error.

    Returns 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

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    • V

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • value: V

      Potential expected property value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Alias to deepEqual

    T Type of the objects.

    Type Parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that a function does not change the value of a property.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • modifier: Function

      Function to run.

    • object: T

      Container object.

    • property: string

      Property of object expected not to be modified.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that a function does not decrease an object property.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • modifier: Function

      Function to run.

    • object: T

      Container object.

    • property: string

      Property of object expected not to be decreased.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {
          [key: string]: any;
      }

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {
          [key: string]: any;
      }

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {
          [key: string]: any;
      }

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {
          [key: string]: any;
      }

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that a function does not increase an object property.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • modifier: Function

      Function to run.

    • object: T

      Container object.

    • property: string

      Property of object expected not to be increased.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that fn will not throw an error.

    Parameters

    • fn: (() => void)

      Function that may throw.

        • (): void
        • Returns void

    • Optional errMsgMatcher: string | RegExp

      Expected error message matcher.

    • Optional ignored: any

      Ignored parameter.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that fn will not throw an error.

    Parameters

    • fn: (() => void)

      Function that may throw.

        • (): void
        • Returns void

    • Optional errorLike: null | Error | ErrorConstructor

      Expected error constructor or error instance.

    • Optional errMsgMatcher: null | string | RegExp

      Expected error message matcher.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts non-strict equality (==) of actual and expected.

    T Type of the objects.

    Type Parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that the target is neither null nor undefined.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object is extensible (can have new properties added to it).

    T Type of object

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Throws a failure.

    Parameters

    • Optional message: string

      Message to display on error.

    Returns never

    Remarks

    Node.js assert module-compatible.

  • Throws a failure.

    T Type of the objects.

    Type Parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    • Optional operator: string

      Comparison operator, if not strict equality.

    Returns never

    Remarks

    Node.js assert module-compatible.

  • Asserts that object is frozen (cannot have new properties added to it and its existing properties cannot be removed).

    T Type of object

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {
          [key: string]: any;
      }

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {
          [key: string]: any;
      }

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {
          [key: string]: any;
      }

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • keys: (string | Object)[] | {
          [key: string]: any;
      }

      Keys to check

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts if value is not a false value, and throws if it is a true value.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

    Remarks

    This is added to allow for chai to be a drop-in replacement for Node’s assert class.

  • Asserts that haystack includes needle.

    Parameters

    • haystack: string

      Container string.

    • needle: string

      Potential substring of haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack includes needle.

    T Type of values in haystack.

    Type Parameters

    • T

    Parameters

    • haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>

      Container array, set or map.

    • needle: T

      Potential value contained in haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack includes needle.

    T Type of values in haystack.

    Type Parameters

    • T extends object

    Parameters

    • haystack: WeakSet<T>

      WeakSet container.

    • needle: T

      Potential value contained in haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack includes needle.

    T Type of haystack.

    Type Parameters

    • T

    Parameters

    • haystack: T

      Object.

    • needle: Partial<T>

      Potential subset of the haystack's properties.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that subset is included in superset using deep equality checking. Order is not take into account.

    T Type of set values.

    Type Parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential contained set of values.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential contained set of values.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that subset is included in superset. Order is not take into account.

    T Type of set values.

    Type Parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential contained set of values.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential contained set of values.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that a function increases an object property.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • modifier: Function

      Function to run.

    • object: T

      Container object.

    • property: string

      Property of object expected to be increased.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is an instance of constructor.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • constructor: Function

      Potential expected contructor of value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts valueToCheck is strictly greater than (>) valueToBeAbove.

    Parameters

    • valueToCheck: number

      Actual value.

    • valueToBeAbove: number

      Minimum Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is an array.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast.

    Parameters

    • valueToCheck: number

      Actual value.

    • valueToBeAtLeast: number

      Minimum Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts valueToCheck is less than or equal to (<=) valueToBeAtMost.

    Parameters

    • valueToCheck: number

      Actual value.

    • valueToBeAtMost: number

      Minimum Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts valueToCheck is strictly less than (<) valueToBeBelow.

    Parameters

    • valueToCheck: number

      Actual value.

    • valueToBeBelow: number

      Minimum Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is a boolean.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is not undefined.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns 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

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object is extensible (can have new properties added to it).

    T Type of object

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is false.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is a finite number. Unlike .isNumber, this will fail for NaN and Infinity.

    T Type of value

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object is frozen (cannot have new properties added to it and its existing properties cannot be removed).

    T Type of object

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is a function.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is NaN.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is not an array.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is not a boolean.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object is not extensible.

    T Type of object

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is not false.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns 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

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is not a function.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is not NaN.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is not null.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is not a number.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is not an object of type 'Object' (as revealed by Object.prototype.toString).

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object is falsy.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • value: T
    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object is not sealed.

    T Type of object

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is not a string.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is not true.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is null.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is a number.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is an object of type 'Object' (as revealed by Object.prototype.toString).

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

    Remarks

    The assertion does not match subclassed objects.

  • Asserts that object is truthy.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • value: T
    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object is sealed (can have new properties added to it and its existing properties cannot be removed).

    T Type of object

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is a string.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is true.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is undefined.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object has a length property with the expected value.

    T Type of object.

    Type Parameters

    • T extends {
          length?: number;
      }

    Parameters

    • object: T

      Container object.

    • length: number

      Potential expected length of object.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value matches the regular expression regexp.

    Parameters

    • value: string

      Actual value.

    • regexp: RegExp

      Potential match of value.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • property: string

      Property to test.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • property: string

      Property to test.

    • value: any

      Value to test.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that actual is not deeply equal to expected.

    T Type of the objects.

    Type Parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle. Deep equality is used.

    Parameters

    • haystack: string

      Container string.

    • needle: string

      Potential substring of haystack.

    • Optional message: string

      Message to display on error.

    Returns void

    Deprecated

    Does not have any effect on string. Use Assert#notInclude instead.

  • Asserts that haystack does not includes needle. Deep equality is used.

    T Type of values in haystack.

    Type Parameters

    • T

    Parameters

    • haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>

      Container array, set or map.

    • needle: T

      Potential value contained in haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle. Deep equality is used.

    T Type of haystack.

    Type Parameters

    • T

    Parameters

    • haystack: T

      Object.

    • needle: T extends WeakSet<any>
          ? never
          : Partial<T>

      Potential subset of the haystack's properties.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • property: string

      Property to test.

    • value: any

      Value to test.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    • V

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • value: V

      Potential expected property value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts non-strict inequality (!=) of actual and expected.

    T Type of the objects.

    Type Parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that the target is either null or undefined.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object is not extensible.

    T Type of object

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns 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

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle.

    Parameters

    • haystack: string

      Container string.

    • needle: string

      Potential substring of haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle.

    T Type of values in haystack.

    Type Parameters

    • T

    Parameters

    • haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>

      Container array, set or map.

    • needle: T

      Potential value contained in haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle.

    T Type of values in haystack.

    Type Parameters

    • T extends object

    Parameters

    • haystack: WeakSet<T>

      WeakSet container.

    • needle: T

      Potential value contained in haystack.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that haystack does not includes needle.

    T Type of haystack.

    Type Parameters

    • T

    Parameters

    • haystack: T

      Object.

    • needle: Partial<T>

      Potential subset of the haystack's properties.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential contained set of values.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential not contained set of values.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • superset: T[]

      Actual set of values.

    • subset: T[]

      Potential contained set of values.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value is not an instance of constructor.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • type: Function
    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value does not match the regular expression regexp.

    Parameters

    • expected: any
    • regexp: RegExp

      Potential match of value.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • property: string

      Property to test.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • object: T

      Object to test.

    • property: string

      Property to test.

    • value: any

      Value to test.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object is falsy.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • value: T
    • Optional message: string

      Message to display on error.

    Returns 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.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object has a property named by property.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object has a property named by property with value given by value.

    T Type of object. V Type of value.

    Type Parameters

    • T

    • V

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • value: V

      Potential expected property value.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • set1: T[]

      Actual set of values.

    • set2: T[]

      Potential expected set of values.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • set1: T[]

      Actual set of values.

    • set2: T[]

      Potential expected set of values.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object is not sealed.

    T Type of object

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts strict inequality (!==) of actual and expected.

    T Type of the objects.

    Type Parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value's type is not name, as determined by Object.prototype.toString.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • name: string

      Potential expected type name of value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object is truthy.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • value: T
    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that non-object, non-array value inList appears in the flat array list.

    T Type of list values.

    Type Parameters

    • T

    Parameters

    • inList: T

      Value expected to be in the list.

    • list: T[]

      List of values.

    • Optional message: string

      Message to display on error.

    Returns void

  • Compares two values using operator.

    Parameters

    • val1: OperatorComparable

      Left value during comparison.

    • operator: string

      Comparison operator.

    • val2: OperatorComparable

      Right value during comparison.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Parameters

    • haystack: any
    • needle: any
    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object has a property named by property.

    T Type of object.

    Type Parameters

    • T

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object has a property named by property with value given by value.

    T Type of object. V Type of value.

    Type Parameters

    • T

    • V

    Parameters

    • object: T

      Container object.

    • property: string

      Potential contained property of object.

    • value: V

      Potential expected property value.

    • Optional message: string

      Message to display on error.

    Returns 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.

    Type Parameters

    • T

    Parameters

    • set1: T[]

      Actual set of values.

    • set2: T[]

      Potential expected set of values.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that set1 and set2 have the same members in the same order. Uses a deep equality check.

    T Type of set values.

    Type Parameters

    • T

    Parameters

    • set1: T[]

      Actual set of values.

    • set2: T[]

      Potential expected set of values.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that set1 and set2 have the same members. Order is not take into account.

    T Type of set values.

    Type Parameters

    • T

    Parameters

    • set1: T[]

      Actual set of values.

    • set2: T[]

      Potential expected set of values.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that set1 and set2 have the same members in the same order. Uses a strict equality check (===).

    T Type of set values.

    Type Parameters

    • T

    Parameters

    • set1: T[]

      Actual set of values.

    • set2: T[]

      Potential expected set of values.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that object is sealed (can have new properties added to it and its existing properties cannot be removed).

    T Type of object

    Type Parameters

    • T

    Parameters

    • object: T

      Actual value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts strict equality (===) of actual and expected.

    T Type of the objects.

    Type Parameters

    • T

    Parameters

    • actual: T

      Actual value.

    • expected: T

      Potential expected value.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that fn will throw an error.

    Parameters

    • fn: (() => void)

      Function that may throw.

        • (): void
        • Returns void

    • Optional errMsgMatcher: string | RegExp

      Expected error message matcher.

    • Optional ignored: any

      Ignored parameter.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that fn will throw an error.

    Parameters

    • fn: (() => void)

      Function that may throw.

        • (): void
        • Returns void

    • Optional errorLike: null | Error | ErrorConstructor

      Expected error constructor or error instance.

    • Optional errMsgMatcher: null | string | RegExp

      Expected error message matcher.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that fn will throw an error.

    Parameters

    • fn: (() => void)

      Function that may throw.

        • (): void
        • Returns void

    • Optional errMsgMatcher: string | RegExp

      Expected error message matcher.

    • Optional ignored: any

      Ignored parameter.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that fn will throw an error.

    Parameters

    • fn: (() => void)

      Function that may throw.

        • (): void
        • Returns void

    • Optional errorLike: null | Error | ErrorConstructor

      Expected error constructor or error instance.

    • Optional errMsgMatcher: null | string | RegExp

      Expected error message matcher.

    • Optional message: string

      Message to display on error.

    Returns void

  • Asserts that value's type is name, as determined by Object.prototype.toString.

    T Type of value.

    Type Parameters

    • T

    Parameters

    • value: T

      Actual value.

    • name: string

      Potential expected type name of value.

    • Optional message: string

      Message to display on error.

    Returns void

Generated using TypeDoc