Members
(static) DEFAULT_TIMEOUT_INTERVAL
Default number of milliseconds Jasmine will wait for an asynchronous spec to complete.
(static) MAX_PRETTY_PRINT_ARRAY_LENGTH
Maximum number of array elements to display when pretty printing objects. This will also limit the number of keys and values displayed for an object. Elements past this number will be ellipised.
(static) MAX_PRETTY_PRINT_CHARS
Maximum number of charasters to display when pretty printing objects. Characters past this number will be ellipised.
(static) MAX_PRETTY_PRINT_DEPTH
Maximum object depth the pretty printer will print to. Set this to a lower value to speed up pretty printing if you have large objects.
Methods
(static) addCustomEqualityTester(tester)
Add a custom equality tester for the current scope of specs.
Note: This is only callable from within a beforeEach
, it
, or beforeAll
.
Parameters:
Name | Type | Description |
---|---|---|
tester |
function | A function which takes two arguments to compare and returns a |
- See:
(static) addMatchers(matchers)
Add custom matchers for the current scope of specs.
Note: This is only callable from within a beforeEach
, it
, or beforeAll
.
Parameters:
Name | Type | Description |
---|---|---|
matchers |
Object | Keys from this object will be the new matcher names. |
- See:
(static) any(clazz)
Get a matcher, usable in any matcher
that uses Jasmine's equality (e.g. toEqual
, toContain
, or toHaveBeenCalledWith
),
that will succeed if the actual value being compared is an instance of the specified class/constructor.
Parameters:
Name | Type | Description |
---|---|---|
clazz |
Constructor | The constructor to check against. |
(static) anything()
Get a matcher, usable in any matcher
that uses Jasmine's equality (e.g. toEqual
, toContain
, or toHaveBeenCalledWith
),
that will succeed if the actual value being compared is not null
and not undefined
.
(static) arrayContaining(sample)
Get a matcher, usable in any matcher
that uses Jasmine's equality (e.g. toEqual
, toContain
, or toHaveBeenCalledWith
),
that will succeed if the actual value is an Array
that contains at least the elements in the sample.
Parameters:
Name | Type | Description |
---|---|---|
sample |
Array |
(static) arrayWithExactContents(sample)
Get a matcher, usable in any matcher
that uses Jasmine's equality (e.g. toEqual
, toContain
, or toHaveBeenCalledWith
),
that will succeed if the actual value is an Array
that contains all of the elements in the sample in any order.
Parameters:
Name | Type | Description |
---|---|---|
sample |
Array |
(static) clock() → {Clock}
Get the currently booted mock {Clock} for this Jasmine environment.
Returns:
- Type
- Clock
(static) createSpy(nameopt, originalFnopt) → {Spy}
Create a bare Spy
object. This won't be installed anywhere and will not have any implementation behind it.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String |
<optional> |
Name to give the spy. This will be displayed in failure messages. |
originalFn |
function |
<optional> |
Function to act as the real implementation. |
Returns:
- Type
- Spy
(static) createSpyObj(baseNameopt, methodNames) → {Object}
Create an object with multiple Spy
s as its members.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
baseName |
String |
<optional> |
Base name for the spies in the object. |
methodNames |
Array.<String> | Object | Array of method names to create spies for, or Object whose keys will be method names and values the |
Returns:
- Type
- Object
(static) getEnv() → {Env}
Get the currently booted Jasmine Environment.
Returns:
- Type
- Env
(static) objectContaining(sample)
Get a matcher, usable in any matcher
that uses Jasmine's equality (e.g. toEqual
, toContain
, or toHaveBeenCalledWith
),
that will succeed if the actual value being compared contains at least the keys and values.
Parameters:
Name | Type | Description |
---|---|---|
sample |
Object | The subset of properties that must be in the actual. |
(static) stringMatching(expected)
Get a matcher, usable in any matcher
that uses Jasmine's equality (e.g. toEqual
, toContain
, or toHaveBeenCalledWith
),
that will succeed if the actual value is a String
that matches the RegExp
or String
.
Parameters:
Name | Type | Description |
---|---|---|
expected |
RegExp | String |