AVAHook

class AVAHook(opts)

Abstract interface for test helpers.

Create a new test helper that can later be connected to AVA.

Arguments:
  • opts (AVAHookOptions) – options to configure this {@link AVAHook}.
afterEach()

Register each afterEach() stage with AVA.

beforeEach()

Register each beforeEach() stage with AVA.

cleanup

The list of stages to cleanup, with the description to provide t.afterEach().

dependencies

Dependencies that should be run before this hook.

dependency(name)

Get a local dependency by name.

Arguments:
  • name (String) – the name of the dependency
Returns:

AVAHook – the hook instance.

register()

Register all stage hooks with AVA, and reserve variables.

registerDependencies()

Register all dependencies for this hook.

registerList(list, type)

Register each stage hook with AVA from the given list.

Arguments:
  • list (StageList) – the stages to register
  • type (String) – the AVA hook to register stages with.
registerVariable(varName, instance, requested)

Register a global variable for use in {@link AVAHook} instances. Provides an alternative name if the name is already taken.

Arguments:
  • varName (String) – the name of the variable to reserve.
  • instance (AVAHook) – the instance of {@link AVAHook} (for debugging, etc.)
  • requested (String) – an alternative name requested by the user.
Returns:

String – the final name of the variable that is reserved for this instance.

reserveVariables()

Reserve all variables needed for this instance. If variables are already claimed, alternatives will be found.

setup

The list of stages to setup, with the description to provide t.beforeEach().

variable(name)

Get the globally reserved name for a variable from the non-unique name used for this instnace.

Arguments:
  • name (String) – the local name of the variable.
variables

The names of variables that will be used inside this hook, and exported when the hook is complete.