Fork 0

1.9 KiB

Cucumber.js examples

This repository demonstrates features of Cucumber.js. Each directory contains an independent npm-package with an example.

The packages have standard directory structure:

  • Features are in the feature/ directory and have .feature extension.
  • Step definitions are JavaScript files in feature/steps/.

Running the tests

  1. Go to a directory
  2. Install npm dependencies:
npm install
  1. Run the tests:
npm test

Available examples


The directories with the names starting with a number are parts of a single step-by-step guide which introduces Cucumber.js. Each step of this guide builds on the previous one and contains a few more lines of JavaScript code.

The target project is a small test suite for the JavaScript + operator.


When data tables are used, Cucumber.js provides different views of the data. This directory contains one feature with four scenarios, each of which uses a different way to read the given table. These tests cover all possibilities to access the data in a data table.

See Data tables.


Shows how to use promises and async/await when testing asynchronous code.


Defining steps in TypeScript.


Defines custom parameter types.


Suggests a way to reuse step definitions.


Uses non-default output formatter. See package.json.

See also:


This package contains some failing tests demonstrating object diffs provided by node's native asserts, chai and jest.