Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Nightwatchjs Nightwatch Extension Path Configuration

From Leeroopedia
Revision as of 17:40, 16 February 2026 by Admin (talk | contribs) (Auto-imported from principles/Nightwatchjs_Nightwatch_Extension_Path_Configuration.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Testing, Extensibility, Configuration
Last Updated 2026-02-12 00:00 GMT

Overview

A configuration pattern that registers directory paths from which custom commands and assertions are automatically loaded and registered on the test API.

Description

Extension Path Configuration tells the Nightwatch test runner where to find custom command and assertion modules. By specifying custom_commands_path and custom_assertions_path in the configuration file, all JavaScript modules in those directories are automatically discovered, loaded, and registered on the browser and browser.assert namespaces respectively. Subdirectories create namespaces (e.g., commands/angular/browser.angular.commandName()).

This auto-discovery mechanism eliminates manual registration and enables a plug-and-play approach to extending the testing API.

Usage

Configure extension paths in nightwatch.conf.js whenever creating custom commands or assertions. Paths can be strings or arrays of strings to support multiple directories.

Theoretical Basis

The auto-loading pattern follows these steps:

  1. Scan configured directories for JavaScript modules
  2. Register each module on the appropriate namespace
  3. Subdirectories become namespace prefixes
  4. Filename (without extension) becomes the command/assertion name

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment