Skip to content

@serenity-is/corelib / windowHooks

Variable: windowHooks

const windowHooks: object

Defined in: src/base/services.ts:64

Overrides for the location and the history that getWindowLocation and getWindowHistory return, e.g. for tests, which replace them so that navigation is recorded instead of done, and the history goes back at once. Unlike a spy on those functions, a hook also reaches the calls inside corelib itself, e.g. of the router. A hook that returns undefined falls back to the window's own object.

Type Declaration

history()

history: (opt?) => History

Returns the history to use instead of the window's, or undefined.

Parameters

opt?
top?

boolean

Returns

History

location()

location: (opt?) => Location

Returns the location to use instead of the window's, or undefined.

Parameters

opt?
top?

boolean

Returns

Location