Implementation:Nightwatchjs Nightwatch Cucumber Package Install
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Testing, BDD, Dependency_Management |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
External npm package installation for adding Cucumber.js BDD support to a Nightwatch.js project.
Description
The @cucumber/cucumber package (version 7.3+) is installed as a dev dependency alongside Nightwatch. It provides the Given, When, Then, Before, and After step definition registration functions. The package is external to the Nightwatch repository and must be installed separately.
Usage
Run the npm install command once when setting up Cucumber integration.
Code Reference
Source Location
- Repository: nightwatch
- File: examples/cucumber-js/README.md (lines 6-9)
Signature
npm i @cucumber/cucumber --save-dev
Import
// After installation, import in step definition files:
const { Given, When, Then, Before, After } = require('@cucumber/cucumber');
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| Existing Nightwatch project | Directory | Yes | Project with nightwatch already installed |
Outputs
| Name | Type | Description |
|---|---|---|
| @cucumber/cucumber | npm package | Available in node_modules |
| Given, When, Then | Functions | Step definition registration functions importable |
| Before, After | Functions | Hook registration functions importable |
Usage Examples
Install Cucumber
# Install Cucumber.js (version 7.3 or higher required)
npm i @cucumber/cucumber --save-dev
# Verify installation
npx cucumber-js --version
Related Pages
Implements Principle
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment