@currents/cli

中文文档
4.0.5发布于 2023/12/08MITTypeScriptCommonJS近 30 天下载 5.6万

Integrate Cypress with Currents - a drop-in replacement for Cypress Cloud

原始使用文档
文档目录6 节
  1. CLI Usage
  2. API
  3. run
  4. spawn
  5. Breaking Changes
  6. Version 4+

@currents/cli

Integrate Cypress with Currents - a drop-in replacement for Cypress Cloud

Currents | Changelog | Compatibility | Documentation


Dec 2023 Update

If you are seeing Error: certificate has expired, please upgrade to version 4.0.4+.

March 2023 Update

⭐️ Cypress 12.6.0+ users, please use https://github.com/currents-dev/cypress-cloud if you are seeing Cypress does not support recording test results to this third party service error ⭐️


CLI Usage

Use Currents as an orchestration and recording service. The command passes down all the CLI flags to cypress and executes cypress behind the scenes.

npm install @currents/cli cypress
npx currents run --parallel --record --key XXXXXX --ci-build-id build-001

API

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();

Breaking Changes

Version 4+

Version 4+ doesn't modify the local installation of Cypress. The following complimentary binaries were deprecated:

  • currents-prepare script is deprecated. Use run or spawn API instead.
  • currents-reset script is deprecated, use run or spawn API instead.
  • patch API is deprecated. Use run or spawn instead.

版本与发布记录

@currents/cli 共发布 41 个版本,首次发布于 2021/05/08;过去 12 个月发布了 0 个版本。

版本发布日期距今
4.0.5latest2023/12/082 年前
4.0.42023/12/082 年前
4.0.32023/02/173 年前
4.0.22023/01/193 年前
4.0.12023/01/193 年前
4.0.0-beta.9beta2023/01/113 年前

其他发布通道:aplha → 4.0.0-aplha.0,alpha → 4.0.0-alpha.0,beta → 4.0.0-beta.9。

关于 @currents/cli 的常见问题

@currents/cli 是什么?

Integrate Cypress with Currents - a drop-in replacement for Cypress Cloud

如何安装 @currents/cli?

在项目目录运行 npm install @currents/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 currents,可以用 npx currents 直接运行。

@currents/cli 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@currents/cli 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@currents/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=14.17.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@currents/cli 可以商用吗?

@currents/cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@currents/cli 的下载量有多少?

根据 npm 官方下载统计,@currents/cli 在 2026/10/11 – 2026/11/09 这 30 天内被下载 56,060 次,日均约 1,869 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@currents/cli 还在维护吗?

最新版本 4.0.5 发布于 2023/12/08(2 年前);至今共发布 41 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/05/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。