CucumberConfig
Index
Properties
optionaldryRun
Prepare a test run but don’t run it
Learn more
optionalfailFast
optionalcolors
Enable/disable colors in output. Cucumber 1.x only!
For Cucumber 2.x and above use formatOptions: { colorsEnabled: false }
Note For Cucumber 2.x and above use the CucumberConfig.formatOptions instead.
Disable colors in output in Cucumber 1.x
colors: false
Disable colors in output in Cucumber 2.x and above
formatOptions: { colorsEnabled: false }
Learn more
optionalcompiler
Step definitions and support files can be written in languages that transpile to JavaScript.
To do set the compiler
option to <file_extension>:<module_name>
NoteL For Cucumber 4.x and above use the CucumberConfig.require option instead.
Enable TypeScript support in Cucumber 1.x - 3.x
compiler: 'ts:ts-node/register'
Learn more
optionalformat
Specify additional output formats, optionally supply PATH to redirect formatter output
Learn more
optionalformatOptions
Provide options for formatters
Cucumber 1.x
formatOptions: JSON.stringify({ option: 'value' })
Learn more
optionalname
Only execute the scenarios with name matching the expression.
Learn more
optionalprofile
In order to store and reuse commonly used CLI options,
you can add a cucumber.js
file to your project root directory.
The file should export an object where the key is the profile name
and the value is a string of CLI options.
The profile can be applied with -p <NAME>
or --profile <NAME>
.
This will prepend the profile’s CLI options to the ones provided by the command line.
Multiple profiles can be specified at a time.
If no profile is specified and a profile named default exists, it will be applied.
Learn more
optionalretry
The number of times to retry a failing scenario before marking it as failed.
Cucumber 7.x
retry: 3
Learn more
optionalrerun
Relative path to an output file produced by Cucumber.js rerun
formatter.
Note: that the name of the output file must start with an @
symbol.
Saving details of failed scenarios to @rerun-output.txt
format: [ 'rerun:@rerun-output.txt' ]
Re-running scenarios saved to @rerun-output.txt
rerun: '@rerun-output.txt'
optionalretryTagFilter
Only retry tests matching the given tag expression.
Cucumber 7.x
retry: 3,
retryTagFilter: '@flaky',
Learn more
optionalrequire
Require files or node modules before executing features
Enable TypeScript support in Cucumber 4.x and above
require: 'ts:ts-node/register'
Learn more
optionalimport
optionalrequireModule
optionallanguage
optionaltags
Only run scenarios that match the given tags.
Note: Cucumber 1.x requires the tags
option to be an array of Cucumber tags,
while Cucumber 2.x and above uses a string
with a tag expression.
Cucumber 1.x
// Run all scenarios tagged with `@smoketest`, but not with `@wip`:
tag: [ '@smoketest', '~@wip' ]
Cucumber >= 2.x
// Run all scenarios tagged with `@smoketest`, but not with `@wip`:
tag: '@smoketest and not @wip'
Learn more
optionalstrict
Fail if there are any undefined or pending steps
optionalworldParameters
Provide parameters that will be passed to the world constructor
Specifying worldParameters
as string
worldParameters: JSON.stringify({ isDev: process.env.NODE_ENV !== 'production' })
Specifying worldParameters
as object
worldParameters: { isDev: process.env.NODE_ENV !== 'production' }
Configuration options to be passed to Cucumber CLI. You can specify the options using either camelCase (i.e.
retryTagFilter
) or kebab-case (i.e.retry-tag-filter
) as Serenity/JS will convert them to an appropriate format for you.