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

Interface: SpyStrategy

SpyStrategy

Members

identity :String

Get the identifying information for the spy.

Type:
  • String
Since:
  • 3.0.0

Methods

callFake(fn)

Tell the spy to call a fake implementation when invoked.

Parameters:
Name Type Description
fn function

The function to invoke with the passed parameters.

Since:
  • 2.0.0

callThrough()

Tell the spy to call through to the real implementation when invoked.

Since:
  • 2.0.0

exec()

Execute the current spy strategy.

Since:
  • 2.0.0

rejectWith(value)

Tell the spy to return a promise rejecting with the specified value when invoked.

Parameters:
Name Type Description
value *

The value to return.

Since:
  • 3.5.0

resolveTo(value)

Tell the spy to return a promise resolving to the specified value when invoked.

Parameters:
Name Type Description
value *

The value to return.

Since:
  • 3.5.0

returnValue(value)

Tell the spy to return the value when invoked.

Parameters:
Name Type Description
value *

The value to return.

Since:
  • 2.0.0

returnValues(…values)

Tell the spy to return one of the specified values (sequentially) each time the spy is invoked.

Parameters:
Name Type Attributes Description
values * <repeatable>

Values to be returned on subsequent calls to the spy.

Since:
  • 2.1.0

stub()

Tell the spy to do nothing when invoked. This is the default.

Since:
  • 2.0.0

throwError(something)

Tell the spy to throw an error when invoked.

Parameters:
Name Type Description
something Error | Object | String

Thing to throw

Since:
  • 2.0.0