Specify Cypress config files

Learn how you can specify a Cypress config file for your test runs on BrowserStack.

Starting v1.5.0, you can specify the Cypress config file that you want to use in two ways:

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

Using browserstack.json

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

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

For example:

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 config file for each environment.

Using the CLI

You can use the following CLI param 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 config file

For example:

Command Line
# 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