BrowserStack Cypress CLI
The `browserstack-cypress-cli` is a command-line interface (CLI) tool designed by BrowserStack to enable running Cypress end-to-end tests on BrowserStack's cloud infrastructure. This allows developers to execute their Cypress test suites across a wide array of remote browsers and operating systems, which significantly expands testing coverage beyond local environments. Currently in public beta, the package (latest stable release v1.36.4 as of April 2026) receives frequent updates, often on a weekly or bi-weekly basis, with recent releases focusing on bug fixes, improved logging for Cucumber-Cypress tests, and enhanced dependency management. Its primary differentiator is providing seamless integration with BrowserStack Automate, offering features like parallel test execution, localhost tunneling, and comprehensive test reporting, which are crucial for CI/CD pipelines.
Common errors
-
Cannot find module 'cypress'
cause The BrowserStack environment does not automatically install dependencies from your project's `package.json`.fixYou must explicitly list Cypress (and any other test-specific npm packages) within the `npm_dependencies` object in your `browserstack.json` file. -
EAADRINUSE: address already in use ...
cause This error typically occurs during multiple spec file executions when a port is not properly released, especially on certain operating systems or configurations.fixUpgrade `browserstack-cypress-cli` to v1.36.0 or newer, which includes a fix for 'address already in use' issues during multi-spec executions. -
https-proxy-agent library exceptions
cause Conflict or incompatibility with the `https-proxy-agent` dependency within the CLI's dependency tree.fixUpgrade `browserstack-cypress-cli` to v1.36.1 or newer, which contains a fix addressing these exceptions. -
Invalid gridName for Automate TurboScale sessions
cause Incorrectly specified `gridName` parameter when attempting to use Automate TurboScale features.fixVerify the `gridName` value in your `browserstack.json` matches the accepted values for Automate TurboScale sessions. A warning log was added in v1.32.8 to help debug this. -
Tests are not running on BrowserStack or capabilities are incorrect.
cause Misconfiguration in the `browserstack.json` file, such as incorrect `auth` credentials, `browsers` settings, or `run_settings`.fixCarefully review your `browserstack.json` file, ensuring `username` and `access_key` are correct (preferably using environment variables), and that `browsers` and `run_settings` define valid configurations as per BrowserStack documentation.
Warnings
- gotcha The product is currently in 'Public Beta' status. While functional and actively developed, users should be aware of potential changes or ongoing refinements to features and behavior.
- breaking Cypress tests running on BrowserStack require explicit declaration of `npm_dependencies` within the `browserstack.json` configuration file, even if they are already in `package.json`. BrowserStack does not use `package.json` for dependencies on its remote machines, leading to 'Cannot find module' errors if not specified.
- gotcha Older versions of Cypress (pre-v10) might require different setup or face compatibility issues. Specific support for Cypress logs and steps was added for Cypress v13+.
- breaking Capability conflicts could arise with `auto_import_dev_dependencies`, leading to unexpected behavior during test execution. This was addressed in v1.36.2.
- breaking Issues with the `https-proxy-agent` library could cause exceptions, especially when multiple breaking versions are present in the dependency tree. This was fixed in v1.36.1.
Install
-
npm install browserstack-cypress-cli -
yarn add browserstack-cypress-cli -
pnpm add browserstack-cypress-cli
Quickstart
# Install the BrowserStack Cypress CLI globally
npm install -g browserstack-cypress-cli
# Navigate to your Cypress project directory
cd my-cypress-project
# Generate a sample browserstack.json configuration file
browserstack-cypress init
# Edit browserstack.json to add your BrowserStack credentials and desired capabilities
# Example partial browserstack.json content:
/*
{
"auth": {
"username": "$BROWSERSTACK_USERNAME",
""access_key": "$BROWSERSTACK_ACCESS_KEY"
},
"browsers": [
{
"browser": "chrome",
"os": "Windows 10",
"versions": ["latest"]
}
],
"run_settings": {
"cypress_config_file": "cypress.config.js",
"npm_dependencies": {},
"headless": true
}
}
*/
# Run your Cypress tests on BrowserStack
browserstack-cypress run