Documentation Home
This page is for an older version of Jasmine (3.10).
The current stable version of Jasmine is: 5.4. You can also look at the docs for the next release: Edge

Class: MatchersUtil

MatchersUtil

Utilities for use in implementing matchers.
Note: Do not construct this directly. Jasmine will construct one and pass it to matchers and asymmetric equality testers.

Methods

contains(haystack, needle, customTestersopt) → {boolean}

Determines whether haystack contains needle, using the same comparison logic as MatchersUtil#equals.

Parameters:
Name Type Attributes Description
haystack *

The collection to search

needle *

The value to search for

customTesters <optional>

An array of custom equality testers

Since:
  • 2.0.0
Returns:

True if needle was found in haystack

Type
boolean

equals(a, b, customTestersopt) → {boolean}

Determines whether two values are deeply equal to each other.

Parameters:
Name Type Attributes Description
a *

The first value to compare

b *

The second value to compare

customTesters <optional>

An array of custom equality testers

Since:
  • 2.0.0
Returns:

True if the values are equal

Type
boolean

pp(value) → {string}

Formats a value for use in matcher failure messages and similar contexts, taking into account the current set of custom value formatters.

Parameters:
Name Type Description
value *

The value to pretty-print

Since:
  • 3.6.0
Returns:

The pretty-printed value

Type
string