Skip to content

Lupa API Reference / @pawel-up/lupa/runner / LupaPlugin

Interface: LupaPlugin ​

Defined in: src/runner/types.ts:181

Lupa runner plugin. Hooks into the test orchestrator lifecycle.

Properties ​

boot? ​

optional boot?: (context) => PluginLifecycleResult

Defined in: src/runner/types.ts:210

Executed once when the Orchestrator boots. Useful for starting global services (like a database or proxy). Returns an optional teardown function executed during shutdown.

Parameters ​

context ​

PluginBootContext

Returns ​

PluginLifecycleResult

Use When ​

  • One-time global setup tasks (e.g., starting an external database daemon).
  • Starting an external proxy server that must persist across watch-mode reruns.

Never ​

Use this hook to reset state between test runs (use execute instead).


execute? ​

optional execute?: (context) => PluginLifecycleResult

Defined in: src/runner/types.ts:223

Executed before every test run. In watch mode, this runs multiple times. Useful for per-run telemetry or state resets. Returns an optional teardown function executed at the end of the run (runner:end).

Parameters ​

context ​

PluginExecuteContext

Returns ​

PluginLifecycleResult

Use When ​

  • Attaching custom reporters or telemetry loggers to the emitter.
  • Resetting external state (e.g., clearing a database) before a specific run starts.

Never ​

Use this hook to start services that persist across watch-mode runs (use boot instead).


name ​

name: string

Defined in: src/runner/types.ts:185

Name of the plugin


plan? ​

optional plan?: (context) => PluginLifecycleResult

Defined in: src/runner/types.ts:197

Executed before suites are resolved and the orchestrator boots. Useful for modifying the configuration dynamically or resolving dynamic test files. Returns an optional teardown function executed during shutdown.

Parameters ​

context ​

PluginPlanContext

Returns ​

PluginLifecycleResult

Use When ​

  • Dynamically injecting test files or suites based on external conditions.
  • Overriding CLI arguments or configuration defaults (e.g., forcing --bail on CI).

Never ​

Use this hook to start services that should be available during test execution.


shutdown? ​

optional shutdown?: (context) => void | Promise<void>

Defined in: src/runner/types.ts:232

Executed once when the Orchestrator shuts down.

Parameters ​

context ​

PluginShutdownContext

Returns ​

void | Promise<void>

Use When ​

  • Tearing down the global database daemon or proxy server started in boot().
  • Finalizing custom reports (e.g., sending test run metadata to a dashboard).