@currents/cli

Setup and usage instructions for Cypress integration with Currents Dashboard

In Feb 2023, Cypress.io team decided to to its internal orchestration and recording protocol, preventing the use of @currents/cli (affected versions are 12.6.0+).

Please note

Migrate to cypress-cloud if you are seeing any of the errors below

  • Integrity check failed

  • DecryptionError: JWE Recipients missing or incorrect type

  • Cypress does not support recording test results to this third party service

@current/cli is a small npm package that allows seamless integration of cypress with Currents cloud orchestration service. The package contains an executable script that provides the same CLI and API experience as the original cypress package - they are 100% interchangeable.

> npm install @currents/cli cypress
> npx currents run --record --parallel --key $CURRENTS_RECORD_KEY

In fact, currents runs cypress command behind the scenes, passing down all the CLI flags or API options. currents requires cypress to be installed.

Please note: @currents/cli is designed to be used in CI environments. Using it for running cypress tests interactively is not recommended.

Using @currents/cli

Install both cypress and @currents/cli packages on your system

> npm install @currents/cli cypress
> npx currents run --record --parallel --key #currents_key

Use currents the same way you are using cypress- it accepts the same flags and configuration options. Usually, you end up running a somewhat similar command as part of your CI build:

npx currents run --record --parallel --ci-build-id $BUILD_ID --key $CURRENTS_KEY

Learn more about obtaining a Record Key and generating a CI Build ID

API - Programmatic Usage

Please note: the documentation below is for the most recent version of the package. Please refer to the package changelog for details about the previous versions.

run

Run Cypress via its Module API

run(config: CypressCommandLine.CypressRunOptions): Promise<CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult>

Example:

import { run } from "@currents/cli";

const cypressOptions: Partial<CypressCommandLine.CypressRunOptions> = {
  browser: "chrome",
  parallel: true,
  record: true,
  key: "Currents key from https://app.currents.dev",
  tag: "smoke",
};
const results = await run(cypressOptions);

spawn

Spawn Cypress as a child process and inherit all the flags and environment variables. It invokes process.exit with the child process' exit code at the end of its execution.

spawn(): Promise<void>

Example:

import { spawn } from "@currents/cli";

await spawn();

Integration Details

currents CLI tool uses the public APIs of cypress runner. It connects the runner to Currents servers for orchestration, parallelization and reporting the results. It uses another open-source tool from the sorry-cypress project (cy2).

Compatibility

Please refer to Compatibility.

Deprecated Functionality

Additional tools within @currents/cli [deprecated]

Deprecated: this functionality was deprecated in @currents/cli@4+

The package contains a few other utilities:

  • currents-prepare - reconfigures cypress to use Currents dashboard without automatically launching cypress runner

  • currents-reset - restores the original Cypress runner configuration

Using currents-prepare CLI [deprecated]

Deprecated: this functionality was deprecated in @currents/cli@4+

currents-prepare can be useful when you need to invoke custom scripts that run cypress behind the scenes.

For example: let's say you have a custom script that's starting cypress via its Module API. Before running the custom script, you'd run currents-prepare. It will change cypress configuration to use Currents Dashboard:

npm install @currents/cli cypress-repeat
npx currents-prepare
npx cypress-repeat ...

Uninstalling currents

Please note: this functionality is only relevant for versions 3 and below.

Older versions of @currents/cli (prior to 3) were used to modify cypress installation. Use one of the following methods for restoring the original cypress configuration and removing Currents from cypress package:

  • Run npx currents-reset from @currents/cli npm package to restore the original configuration

  • Run cypress install --force to install a fresh version of cypress binaries

  • Reinstall cypress npm package from scratch

MacOS Ventura Users

Running the commands in an interactive shell (or VSCode) can fail withEPERM: operation not permitted error.

You need to explicitly allow the shell app (or VSCode) to modify other applications.

Add the app to the App Management allowed list to stop the error.

Mac OS Settings > Privacy and Security > App Management

Last updated