Skip to main content
Cypress 10 support is here! Upgrade your BrowserStack Cypress-CLI to v1.18.0 and start testing. Try now!

Specify Cypress configuration files

Learn how to specify a Cypress configuration file for your test runs on BrowserStack.

Starting BrowserStack Cypress-CLI v1.5.0, you can specify the Cypress configuration file that you want to use in two ways:

  1. Mentioning the configuration file details in browserstack.json
  2. Using the --cypress-config-file CLI parameter

Using browserstack.json

You can use the cypress_config_file key in run_settings option to specify the Cypress configuration file that you want to use.

Key Accepted values
cypress_config_file Path (absolute or relative to browserstack.json) to the Cypress configuration file

For example:

// browserstack.json

{
  ...
  "run_settings": {
    ...
    "cypress_config_file": "./cypress.config.js"
    ...
  }
  ...
}
// browserstack.json

{
  ...
  "run_settings": {
    ...
    "cypress_config_file": "./cypress.json"
    ...
  }
  ...
}
Protip: We recommend that you create multiple BrowserStack config files for each of your environments of test types (for example, one each for staging, production, regression, P1 tests etc.,) and use the relevant Cypress configuration file for each environment.

Using the CLI

You can use the following CLI parameter while running the tests using the run command:

Arg Shorthand Accepted values
--cypress-config-file --ccf Path (absolute or relative to browserstack.json) to the Cypress configuration file

For example:

# Pass a relative path to the CLI
browserstack-cypress run --sync --cypress-config-file ./cypress.config.js

# Pass an absolute path like this
browserstack-cypress run --sync --cypress-config-file /Users/holmes/project/tests/cypress.config.js
# Pass a relative path to the CLI
browserstack-cypress run --sync --cypress-config-file ./cypress.json

# Pass an absolute path like this
browserstack-cypress run --sync --cypress-config-file /Users/holmes/project/tests/cypress.staging.json

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Talk to an Expert