Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 2.54 KB

cli.md

File metadata and controls

59 lines (42 loc) · 2.54 KB

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

Note on global installs: Cucumber does not work when installed globally because @cucumber/cucumber needs to be required in your support files and globally installed modules cannot be required.

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: