Configuration

June 30, 2026 · View on GitHub

← Back to documentation

Configuration

The preprocessor uses cosmiconfig, which means you can place configuration options in EG. .cypress-cucumber-preprocessorrc.json or package.json, with corresponding examples shown below.

// .cypress-cucumber-preprocessorrc.json
{
  "json": {
    "enabled": true
  }
}
// package.json
{
  "dependencies": {
    "@badeball/cypress-cucumber-preprocessor": "latest"
  },
  "cypress-cucumber-preprocessor": {
    "json": {
      "enabled": true
    }
  }
}

Type-specific configuration

Configuration values for specific types of testing (e2e / component) can be configured using respective blocks, like shown below.

// .cypress-cucumber-preprocessorrc.json
{
  "e2e": {
    "stepDefinitions": "cypress/e2e/[filepath].{js,mjs,ts,tsx}"
  },
  "component": {
    "stepDefinitions": "src/[filepath].{js,mjs,ts,tsx}"
  }
}

Caveats / Debugging

Notice that configuration, when package.json is used, must be placed within the "cypress-cucumber-preprocessor": { .. } block. This does not apply if EG. .cypress-cucumber-preprocessorrc.json is used, as this is a file solely dedicated to preprocessor configuration, while package.json is not.

If you place configuration values in multiple locations, only one of them will apply and take affect. The implication of this is that if you have an empty "cypress-cucumber-preprocessor": { .. } block within your package.json and try to write another configuration file, then you will be surprised to find that nothing seems to work.

If you're unsure of what configuration values is actually being applied, then you can run Cypress with the following to enable debug output which will tell you.

$ DEBUG=cypress:electron,cypress-configuration,cypress-cucumber-preprocessor cypress run

Configuration overrides

Configuration options can be overridden using (Cypress-) environment variable. The filterSpecs options (described in docs/tags.md) can for instance be overridden by running Cypress like shown below.

$ cypress run -e filterSpecs=true

Cypress environment variables can also be configured through ordinary environment variables, like shown below.

$ CYPRESS_filterSpecs=true cypress run

Every configuration option has a similar key which can be use to override it, shown in the table below.

JSON pathEnvironment keyExample(s)
stepDefinitionsstepDefinitions[filepath].{js,ts}
messages.enabledmessagesEnabledtrue, false
messages.outputmessagesOutputcucumber-messages.ndjson
json.enabledjsonEnabledtrue, false
json.outputjsonOutputcucumber-report.json
html.enabledhtmlEnabledtrue, false
html.outputhtmlOutputcucumber-report.html
usage.enabledusageEnabledtrue, false
usage.outputusageOutputstdout
pretty.enabledprettyEnabledtrue, false
filterSpecsMixedModefilterSpecsMixedModehide, show, empty-set
filterSpecsfilterSpecstrue, false
omitFilteredomitFilteredtrue, false
dryRundryRuntrue, false
attachments.addScreenshotsattachmentsAddScreenshotstrue, false
attachments.addVideosattachmentsAddVideostrue, false

Test configuration

Some of Cypress' configuration options can be overridden per-test, see Test configuration.