Skip to main content

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"
    // For Cypress version 9 or lower
    //"cypress_config_file": "./cypress.json"
    ...
  }
  ...
}

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. Set as cypress.config.js for v10 and above, and cypress.json for v9 and below.

For example:

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

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

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
Download Copy