Links

Currents CLI

Integrate Cypress with Currents using @currents/cli
@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 Cypress 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 Cypress Compatibility.

Troubleshooting and Debugging

If you are experiencing issues with using @currents/cli, please submit a support request either via in-app support chat or on GitHub.
Modify your CI configuration and add the following commands. Share the output as part of a ticket or conversation with a support person.
  • Get the(CI) environment information
npx envinfo --system --binaries --browsers --npmPackages --duplicates --npmGlobalPackages
  • Get the debug logs
# on Linux
DEBUG=cy2*,cypress:* npx currents run ...
# on Windows
cmd /V /C "set DEBUG=cy2*,cypress:*&& npx currents run ..."
Please capture the whole debug log - that will help the support person to identify the root cause faster.

Deprecated Functionality

Additional tools within @currents/cli [deprecated]

Deprecated: this functionality was deprecated in @currents/[email protected]+
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/[email protected]+
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