@testwatch/cli

中文文档
0.3.0发布于 2026/11/02MITES Module零依赖

Run your TestWatch end-to-end tests from CI and wait for the verdict.

原始使用文档

@testwatch/cli

Run your TestWatch end-to-end tests from any CI and wait for the verdict.

export TESTWATCH_API_KEY=tw_…        # TestWatch → Settings → API keys
npx @testwatch/cli run --app <app id> --wait --junit testwatch.xml

--wait waits for the final verdict, after TestWatch has checked every failure:

VerdictMeaning
passevery test passed (flaky passes included)
real_bugthe app is broken
needs_reviewa test failed and needs a person (often: the app changed)
infrathe app or its login wasn't usable, or the run was cancelled

Exit codes:

CodeMeaning
0the verdict isn't in --fail-on (default real_bug,needs_review,infra)
1the verdict is in --fail-on
2usage, auth, plan, network or timeout error
130interrupted. The run is cancelled unless --no-cancel-on-abort is set.

Other options:

  • --env <name>: the environment to run against
  • --env-url <deployed url>: a deployed URL. It matches an environment's own URL or one of its preview patterns.
  • --url <preview url>: run against this preview URL (with --env, or the app's default environment). It must match the environment's preview patterns. Not with --env-url.
  • --tag <t> (repeatable)
  • --tests <ids>
  • --account <name|id>: sign every test that signs in as this account (default: each test's own login). Tests where it isn't used on the environment are skipped; tests that don't sign in stay signed out.
  • --timeout 30m
  • --json
  • testwatch whoami checks a key.

Preview runs print Preview · <host>. When TestWatch proposes a PR fix for a test on that branch, the report prints PR fix proposed — accept: <link>: accept it in TestWatch, then re-run the job. Tests that ran with an accepted PR fix are marked (ran with accepted PR fix). The exit code doesn't change.

On GitHub Actions it writes a job summary, annotations and the outputs run-id, url and verdict. There is also a ready-made action: testwatch-dev/action@v1.

Security and support

  • Manufacturer: Vasyl Harastei (TestWatch), Solná 24/23, 746 01 Opava - Město, Czech Republic.
  • Report a vulnerability: [email protected]. Disclosure policy: https://testwatch.dev/security#report.
  • Support period: security fixes for each major version for at least 5 years after each major version's release.
  • SBOM: generate a software bill of materials for the installed package with npm sbom (e.g. npm sbom --sbom-format cyclonedx in a project that depends on @testwatch/cli).
  • The CLI has no runtime dependencies. Fixed vulnerabilities are published as GitHub security advisories on github.com/testwatch-dev.

版本与发布记录

@testwatch/cli 共发布 5 个版本,首次发布于 2026/10/09;过去 12 个月发布了 5 个版本。

版本发布日期距今
0.3.0latest2026/11/02今天
0.2.12026/10/2014 天前
0.2.02026/10/1024 天前
0.1.02026/10/0925 天前
0.0.0-stage2026/10/0925 天前

关于 @testwatch/cli 的常见问题

@testwatch/cli 是什么?

从CI运行您的TestWatch端到端测试并等待判决。

如何安装 @testwatch/cli?

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

@testwatch/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/testwatch__cli 是否存在。

@testwatch/cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

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

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

@testwatch/cli 可以商用吗?

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

@testwatch/cli 还在维护吗?

最新版本 0.3.0 发布于 2026/11/02(今天);至今共发布 5 个版本,其中过去 12 个月发布了 5 个;首次发布于 2026/10/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。