{"id":22400111,"url":"https://github.com/currents-dev/cypress-cloud","last_synced_at":"2025-04-12T19:50:30.141Z","repository":{"id":131543854,"uuid":"567037803","full_name":"currents-dev/cypress-cloud","owner":"currents-dev","description":"Debug, troubleshoot and record Cypress CI tests in Cloud","archived":false,"fork":false,"pushed_at":"2025-04-02T22:50:30.000Z","size":3199,"stargazers_count":49,"open_issues_count":2,"forks_count":17,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-12T19:50:01.247Z","etag":null,"topics":["ci","cypress","e2e","parallel","sorry-cypress"],"latest_commit_sha":null,"homepage":"https://currents.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/currents-dev.png","metadata":{"files":{"readme":".github/README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-16T23:53:10.000Z","updated_at":"2025-04-02T22:50:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"eebebf9c-7900-4836-a521-2e7636485a4d","html_url":"https://github.com/currents-dev/cypress-cloud","commit_stats":{"total_commits":350,"total_committers":14,"mean_commits":25.0,"dds":"0.24571428571428566","last_synced_commit":"2a33dbc9a23f63c6edea9f6cc1ea6944b8857226"},"previous_names":[],"tags_count":64,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/currents-dev%2Fcypress-cloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/currents-dev%2Fcypress-cloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/currents-dev%2Fcypress-cloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/currents-dev%2Fcypress-cloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/currents-dev","download_url":"https://codeload.github.com/currents-dev/cypress-cloud/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625501,"owners_count":21135513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci","cypress","e2e","parallel","sorry-cypress"],"created_at":"2024-12-05T08:11:25.939Z","updated_at":"2025-04-12T19:50:30.120Z","avatar_url":"https://github.com/currents-dev.png","language":"TypeScript","readme":"# Debug, troubleshoot and record Cypress CI tests in Cloud\n\nIntegrate Cypress with alternative cloud services like Currents or Sorry Cypress.\n\n**[Currents](https://currents.dev/?utm_source=cypress-cloud)** - a drop-in replacement for Cypress Dashboard. Run, debug, troubleshoot and analyze parallel CI tests in cloud. This is an enhanced version of Sorry Cypress with better security, performance, analytics, integrations and support.\n\n**[Sorry Cypress](https://sorry-cypress.dev/?utm_source=cypress-cloud)** - is an open-source, free alternative to Cypress Dashboard that unlocks unlimited parallelization, test recordings, and integration with GitHub, Slack and more.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"830\" src=\"https://user-images.githubusercontent.com/1637928/213367982-78987b7a-411a-4d2e-9486-ca204847022e.png\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"../CHANGELOG.md\"\u003eChangelog\u003c/a\u003e | \u003ca href=\"https://currents.dev/readme/guides/cypress-compatibility\"\u003eCompatibility\u003c/a\u003e |\n\u003ca href=\"https://currents.dev/readme\"\u003eDocumentation\u003c/a\u003e | \u003ca href=\"https://github.com/currents-dev/cypress-cloud/blob/main/LICENSE.md\"\u003eLicense\u003c/a\u003e\n\n\u003c/p\u003e\n\n## Table of Contents\n\n- [Requirements](#requirements)\n- [Setup](#setup)\n- [Usage](#usage)\n- [Example](#example)\n- [Configuration](#configuration)\n  - [Configuration File Discovery](#configuration-file-discovery)\n  - [Configuration Overrides](#configuration-overrides)\n- [Batched Orchestration](#batched-orchestration)\n- [API](#api)\n  - [`run`](#run)\n- [Guides](#guides)\n  - [Usage with `@cypress/grep`](#usage-with-cypressgrep)\n  - [Setup with existing plugins](#setup-with-existing-plugins)\n    - [Preserving `config.env` values](#preserving-configenv-values)\n    - [Chaining `config`](#chaining-config)\n    - [Event callbacks for multiple plugins](#event-callbacks-for-multiple-plugins)\n- [Spec files discovery](#spec-files-discovery)\n- [Usage with ESM project](#usage-with-esm-project)\n- [Troubleshooting](#troubleshooting)\n- [Testing](#testing)\n- [Releasing](#releasing)\n  - [Beta channel](#beta-channel)\n  - [Latest channel](#latest-channel)\n  - [Localhost](#localhost)\n\n## Requirements\n\n- Cypress version 10+\n- NodeJS 14.7.0+\n\n## Setup\n\nInstall the package:\n\n```sh\nnpm install cypress-cloud\n```\n\n- Create a new configuration file: `currents.config.js|mjs|cjs` in the Cypress project’s root. Use `--cloud-config-file` to explicitly provide the configuration file. Using ESM project? See the guide below.\n- Set the `projectId` and the record key obtained from [Currents](https://app.currents.dev) or your self-hosted instance of Sorry Cypress:\n\n```js\n// currents.config.js\nmodule.exports = {\n  projectId: \"Ij0RfK\",\n  recordKey: \"xxx\",\n  // Sorry Cypress users - set the director service URL\n  cloudServiceUrl: \"https://cy.currents.dev\",\n};\n```\n\nAdd `cypress-cloud/plugin` to `cypress.config.{js|ts|mjs}`\n\n```ts\n// cypress.config.js\nimport { defineConfig } from \"cypress\";\nimport { cloudPlugin } from \"cypress-cloud/plugin\";\n\nexport default defineConfig({\n  e2e: {\n    video: true; // enable video for cypress@13+\n    async setupNodeEvents(on, config) {\n      const result = await cloudPlugin(on, config);\n      return result;\n    },\n  },\n});\n```\n\nAdd `cypress-cloud/support` to Cypress Support file (matching your test type - e2e or component, or both)\n\n```ts\nimport \"cypress-cloud/support\";\n```\n\n## Usage\n\n```sh\nnpx cypress-cloud --parallel --record --key \u003cyour_key\u003e --ci-build-id hello-cypress-cloud\n```\n\n`cypress-cloud` is designed for use in a headless mode in a CI environment, it provides the same flags and options as `cypress` command, but certain flags are preset and hidden. See all the available options `npx cypress-cloud --help`.\n\nLearn more about [CI Build ID](https://currents.dev/readme/guides/cypress-ci-build-id) and [Parallelization](https://currents.dev/readme/guides/parallelization).\n\n## Example\n\nSee an example in [examples/webapp](https://github.com/currents-dev/cypress-cloud/blob/main/examples/webapp) directory.\n\n## Configuration\n\n```js\n// currents.config.js\nmodule.exports = {\n  projectId: \"Ij0RfK\", // Project Id obtained from https://app.currents.dev or Sorry Cypress\n  recordKey: \"XXXXXXX\", // Record key obtained from https://app.currents.dev, any value for Sorry Cypress\n  cloudServiceUrl: \"https://cy.currents.dev\", // Sorry Cypress users - the director service URL\n  // Additional headers for network requests, undefined by default\n  networkHeaders: {\n    \"User-Agent\": \"Custom\",\n    \"x-ms-blob-type\": \"BlockBlob\",\n  },\n  e2e: {\n    batchSize: 3, // orchestration batch size for e2e tests (Currents only, read below)\n  },\n  component: {\n    batchSize: 5, // orchestration batch size for component tests (Currents only, read below)\n  },\n  retry: {\n    hardFailureMaxRetries: 2, // max retries for hard Cypress failures, a hard failure is when Cyrpess crashes and doesn't report back any results (see https://docs.cypress.io/guides/guides/module-api#Handling-errors)\n  },\n};\n```\n\n### Configuration File Discovery\n\n`cypress-cloud` will search for a configuration file as follows:\n\n- if `--cloud-config-file \u003cstring\u003e` is defined, use its value\n\n  - use it as-is for absolute paths\n  - if it's a relative path, use the project's root location (defined with `-P --project` CLI option) as the base directory\n\n- otherwise, use the default filenames in the project's root location (defined with `-P --project` CLI option) in the following order:\n  - `currents.config.js`\n  - `currents.config.cjs`\n  - `currents.config.mjs`\n\nThe configuration file will be read using [`import()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) expression. Please make sure to use the correct syntax if you're using ESM modules (see the guide below).\n\n### Configuration Overrides\n\nYou can override the configuration values via environment variables:\n\n- `CURRENTS_API_URL` - sorry-cypress users - set the URL of your director service\n- `CURRENTS_PROJECT_ID` - set the `projectId`\n- `CURRENTS_RECORD_KEY` - cloud service record key\n\nThe configuration variables will resolve as follows:\n\n- the corresponding CLI flag or `run` function parameter, otherwise\n- environment variable if exist, otherwise\n- configuration file `currents.config.js|cjs|mjs` value, otherwise\n- the default value, otherwise throw\n\n## Batched Orchestration\n\nThis package uses its own orchestration and reporting protocol that is independent of cypress native implementation. The new [orchestration protocol](\u003c[https://currents.dev/readme/integration-with-cypress/cypress-cloud#batched-orchestration](https://currents.dev/readme/integration-with-cypress/cypress-cloud/batched-orchestration)\u003e) uses cypress in \"offline\" mode and allows batching multiple spec files for better efficiency. You can adjust the batching configuration in `currents.config.js` and use different values for e2e and component tests.\n\n## API\n\n### `run`\n\nRun Cypress tests programmatically. See [`./examples/webapp/scripts`](https://github.com/currents-dev/cypress-cloud/blob/main/examples/webapp/scripts) for examples.\n\n```ts\nrun(params: CurrentsRunAPI): Promise\u003cCypressCommandLine.CypressRunResult | undefined\u003e\n```\n\n- `params` - [`CurrentsRunAPI`](./packages/cypress-cloud/types.ts) list of params. It is an extended version of Cypress [Module API](https://docs.cypress.io/guides/guides/module-api)\n- return execution results as [`CypressCommandLine.CypressRunResult | undefined`](./packages/cypress-cloud/types.ts)\n\nExample:\n\n```ts\nimport { run } from \"cypress-cloud\";\n\nconst results = await run({\n  recordKey: \"some\",\n  reporter: \"junit\",\n  browser: \"chrome\",\n  config: {\n    baseUrl: \"http://localhost:8080\",\n    video: true,\n  },\n});\n```\n\n## Guides\n\n### Usage with `@cypress/grep`\n\nThe package is compatible with [`@cypress/grep`](https://www.npmjs.com/package/@cypress/grep).\n\n`@cypress/grep` modifies cypress configuration and alters `specPattern` property. Install `@cypress/grep` **before** `cypress-cloud/plugin` to apply the modified configuration. For example:\n\n```ts\nimport { defineConfig } from \"cypress\";\nimport grepPlugin from \"@cypress/grep/src/plugin\";\nimport { cloudPlugin } from \"cypress-cloud/plugin\";\n\nexport default defineConfig({\n  e2e: {\n    // ...\n    async setupNodeEvents(on, config) {\n      grepPlugin(config);\n      const result = await cloudPlugin(on, config);\n      return result;\n    },\n  },\n});\n```\n\nPlease refer to the [issue](https://github.com/currents-dev/cypress-cloud/issues/50#issuecomment-1645095284) for details.\n\n### Setup with existing plugins\n\n#### Preserving `config.env` values\n\nThe `config` parameter of `setupNodeEvents(on, config)` has pre-defined `config.env` values. Please make sure to preserve the original `config.env` value when altering the property. For example:\n\n```ts\nimport { defineConfig } from \"cypress\";\nimport { cloudPlugin } from \"cypress-cloud/plugin\";\n\nexport default defineConfig({\n  e2e: {\n    // ...\n    async setupNodeEvents(on, config) {\n      const enhancedConfig = {\n        env: {\n          ...config.env, // 👈🏻 preserve the original env\n          customVariable: \"value\",\n        },\n      };\n      const result = await cloudPlugin(on, enhancedConfig);\n      return result;\n    },\n  },\n});\n```\n\n#### Chaining `config`\n\nCertain plugins (e.g. `@cypress/grep`) modify or alter the `config` parameter and change the default Cypress behaviour. Make sure that `cypress-cloud` is initialized with the most recently updated `config`, e.g.:\n\n```ts\nimport { defineConfig } from \"cypress\";\nimport { cloudPlugin } from \"cypress-cloud/plugin\";\n\nexport default defineConfig({\n  e2e: {\n    // ...\n    async setupNodeEvents(on, config) {\n      const configA = pluginA(on, config); // configA has the modified config from pluginA\n      const configB = pluginB(on, configA); // configA has the modified config from pluginA + pluginB\n      // ...\n      const configX = pluginX(on, configY); // configX has the modified config from all preceding plugins\n      const result = await cloudPlugin(on, configX); // cloudPlugin has the accumulated config from all plugins\n      return result;\n    },\n  },\n});\n```\n\n#### Event callbacks for multiple plugins\n\n`cypress-cloud/plugin` uses certain Cypress Plugin events. Unfortunately if there are mutliple listeners for an event, only the last listener is called (see the [GitHub issue](https://github.com/cypress-io/cypress/issues/22428)). Setups with multiple plugins can create conflicts - one plugin can replace listeners of others.\n\nThe existing workaround is to patch the `on` function by using either of:\n\n- https://github.com/bahmutov/cypress-on-fix\n- https://github.com/elaichenkov/cypress-plugin-init\n\nFor example:\n\n```ts\nimport { defineConfig } from \"cypress\";\nimport { cloudPlugin } from \"cypress-cloud/plugin\";\nimport patchCypressOn from \"cypress-on-fix\";\n\nexport default defineConfig({\n  e2e: {\n    // ...\n    async setupNodeEvents(cypressOn, config) {\n      const on = patchCypressOn(cypressOn);\n      // the rest of the plugins use the patched \"on\" function\n      const configAlt = somePlugin(on, config);\n      const result = await cloudPlugin(on, configAlt);\n      return result;\n    },\n  },\n});\n```\n\n### Spec files discovery\n\n`cypress-cloud` discovers the spec files using [`globby`](https://www.npmjs.com/package/globby) patterns according to the following logic:\n\n- if no `--spec` is provided, use the `specPattern` defined in `cypress.config.{jt}s`\n- if `--spec` flag is provided, use the intersection of `specPattern` and `--spec`\n- if no spec files were discovered, halt the execution and show a warning\n\nEnable the debug mode to troubleshoot files discovery: `DEBUG=currents:specs npx cypress-cloud ...`\n\n### Usage with ESM project\n\nFor ESM projects (`\"type\": \"module\"` in `package.json`) you can use one of the following formats:\n\n- `currents.config.cjs` - CommonJS formatted file\n- `currents.config.js` - ESM formatted file (i.e. no `require` statements)\n- `currents.config.mjs` - ESM formatted file (i.e. no `require` statements)\n\nAlso, make sure that your `cypress.config.js|mjs|cjs|ts` is formatted accordingly. See examples in [`./e2e`](./e2e) directory.\n\n## Troubleshooting\n\nEnable the debug mode by adding `--cloud-debug true | all | cypress | currents | commit-info` flag\n\n- `true | all` enable debug mode for all the tools\n- `cypress` activate debug mode for cypress only\n- `currents` activate the debug mode for currents only\n- `commit-info` activate the debug mode for git commit info only\n\n```sh\n# show all the debug information\nnpx cypress-cloud run ... --cloud-debug\n\n# show only currents related debug information\nnpx cypress-cloud run ... --cloud-debug currents,commit-info\n```\n\nCapture all the logs as a plain text file and share it with the support team for further troubleshooting.\n\n## Testing\n\n```sh\nnpm run test\n```\n\n\u003e Please note, we use `esbuild` for building and `swc` for testing. In addition, jest has built-in module aliases, but eslint does not. Beware of importing aliases in non-testing code.\n\n## Releasing\n\n### Beta channel\n\n```sh\ncd packages/cypress-cloud\nnpm run release -- --preRelease=beta \u0026\u0026 npm run release:npm -- -t beta\n```\n\n### Latest channel\n\n```sh\ncd packages/cypress-cloud\nnpm run release \u0026\u0026 npm run release:npm -- -t latest\n```\n\n### Localhost\n\nPublishing from `packages/cypress-cloud`:\n\n```sh\ndocker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio\nnpm adduser --registry http://localhost:4873\nnpm login --registry http://localhost:4873\nnpm_config_registry=http://localhost:4873  npm run release:npm -- --tag latest\n```\n\nUsing:\n\n```sh\nnpm install cypress-cloud --registry http://localhost:4873\n```\n\n## License\n\nGNU General Public License Version 3\n\nCopyright (C) 2023 Currents Software Inc https://currents.dev.\n\nThis is free software, and you are welcome to redistribute it under certain\nconditions. This program comes with no warranty. Parts of this program are MIT\nlicensed. Refer to the license for details\nhttps://github.com/currents-dev/cypress-cloud/blob/main/LICENSE.md\n\n## Disclaimer\n\nThis software is not affiliated with Cypress.io Inc. All third-party trademarks and materials (including logos, icons and labels) referenced herein are the property of their respective owners. The third-party products or services that this software connects to are subject to their respective owners, please refer to their intellectual property and terms of service agreements.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurrents-dev%2Fcypress-cloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcurrents-dev%2Fcypress-cloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurrents-dev%2Fcypress-cloud/lists"}