Principle:Nightwatchjs Nightwatch Cucumber Runner Configuration
| Knowledge Sources | |
|---|---|
| Domains | Testing, BDD, Configuration |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
A configuration pattern that switches the test runner from the default engine to Cucumber, mapping feature file paths and execution options.
Description
Cucumber Runner Configuration tells Nightwatch to use Cucumber as its test runner instead of the default Mocha-like engine. This involves setting test_runner.type to cucumber and configuring options like feature_path (glob path to .feature files), auto_start_session (whether to auto-create a WebDriver session), and parallel (number of worker threads for parallel execution).
The configuration also specifies src_folders pointing to step definition directories, so Nightwatch knows where to find the code that implements Gherkin steps.
Usage
Configure the Cucumber runner in nightwatch.conf.js (or a separate config file) before running BDD tests. Use a separate config file when maintaining both E2E and BDD test configurations.
Theoretical Basis
The runner configuration bridges two systems:
- test_runner.type selects the execution engine (cucumber vs default)
- feature_path tells Cucumber where to find .feature files
- src_folders tells Nightwatch where to find step definitions
- auto_start_session controls WebDriver lifecycle management