Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

CLI

Cucumber includes an executable file to run your scenarios. After installing the @cucumber/cucumber package, you can run it directly:

$ ./node_modules/.bin/cucumber-js

Or via a package.json script:

{
  "scripts": {
    "cucumber": "cucumber-js"
  }
}

Or via npx:

$ npx cucumber-js

Options

All the standard configuration options can be provided via the CLI.

Additionally, there are a few options that are specific to the CLI:

Option Type Repeatable Description
--config, -c string No Path to your configuration file - see Files
--profile, -p string[] Yes Profiles from which to include configuration - see Profiles
--version, -v boolean No Print the currently installed version of Cucumber, then exit immediately
--i18n-keywords string No Print the Gherkin keywords for the given ISO-639-1 language code, then exit immediately
--i18n-languages boolean No Print the supported languages for Gherkin, then exit immediately

To see the available options for your installed version, run:

$ cucumber-js --help

Exiting

By default, cucumber exits when the event loop drains. Use the forceExit configuration option in order to force shutdown of the event loop when the test run has finished:

  • In a configuration file { forceExit: true }
  • On the CLI $ cucumber-js --force-exit

This is discouraged, as fixing the issues that causes the hang is a better long term solution. Some potential resources for that are: