apiref
ride@2.0.1

ride.before()  Function

Calls the extraBehavior before the original function will be called.

Signature

function before<T, A extends any[], R>(extraBehavior: (this: T, ...args: A) => void): Decorator<T, (this: T, ...args: A) => R>;

Remarks

If extraBehavior throws an error, the original function will NOT be called. Any returned value from extraBehavior will be ignored.

Example

ride(test, 'exit', ride.before(captureScreenshot))

Parameters

ParameterTypeDescription
extraBehavior(this: T, ...args: A) => void

The function to call before the original function is called.

(Returns)Decorator<T, (this: T, ...args: A) => R>