Skip to main content

externalCucumberConfig

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.

Index

Properties

externaloptionalpaths

paths?: string[]

Paths to where your feature files are. Note that you don't need to specify the paths when using Serenity/JS with WebdriverIO or Protractor, as their respective adapters will do it for you.

Learn more

externaloptionaldryRun

dryRun?: boolean

Prepare a test run but don't run it

Learn more

@version

8.x

externaloptionalfailFast

failFast?: boolean

Stop running tests when a test fails

Learn more

@version

8.x

externaloptionalcolors

colors?: boolean

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

@version

1.x

externaloptionalcompiler

compiler?: string

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

@version

1.x - 3.x

externaloptionalformat

format?: string | string[]

Specify additional output formats, optionally supply PATH to redirect formatter output

Learn more

externaloptionalformatOptions

formatOptions?: string | object

Provide options for formatters

Cucumber 1.x

formatOptions: JSON.stringify({ option: 'value' })

Learn more

externaloptionalname

name?: string[]

Only execute the scenarios with name matching the expression.

Learn more

externaloptionalprofile

profile?: string[]

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

externaloptionalretry

retry?: number

The number of times to retry a failing scenario before marking it as failed.

Cucumber 7.x

retry: 3

Learn more

@version

7.x

externaloptionalrerun

rerun?: string

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'

externaloptionalretryTagFilter

retryTagFilter?: string

Only retry tests matching the given tag expression.

Cucumber 7.x

retry: 3,
retryTagFilter: '@flaky',

Learn more

@version

7.x

externaloptionalrequire

require?: string[]

Require files or node modules before executing features

Enable TypeScript support in Cucumber 4.x and above

require: 'ts:ts-node/register'

Learn more

externaloptionalimport

import?: string[]

Paths to where your support code is.

Learn more

@version

8.x

externaloptionalrequireModule

requireModule?: string[]

Names of transpilation modules to load, loaded via require()

Learn more

@version

8.x

externaloptionallanguage

language?: string

Default language for your feature files

Learn more

@version

8.x

externaloptionaltags

tags?: string | string[]

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

externaloptionalstrict

strict?: boolean

Fail if there are any undefined or pending steps

externaloptionalworldParameters

worldParameters?: string | object

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' }

Learn more