Documentation Home
This page is for an older version of Jasmine (3.2).
The current stable version of Jasmine is: 5.4. 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

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.

callThrough()

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

exec()

Execute the current spy strategy.

returnValue(value)

Tell the spy to return the value when invoked.

Parameters:
Name Type Description
value *

The value to return.

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.

stub()

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

throwError(something)

Tell the spy to throw an error when invoked.

Parameters:
Name Type Description
something Error | String

Thing to throw