@augment-vir/test

中文文档
32.7.0发布于 2026/10/29(MIT OR CC0-1.0)TypeScriptES Module近 30 天下载 6.9万

A universal testing suite that works with Mocha style test runners and Node.js's built-in test runner.

原始使用文档

@augment-vir/test

A universal testing suite that works with Mocha style test runners, Node.js's built-in test runner, and Playwright tests with the following main exports:

  • describe: the normal describe test suite function, automatically imported based on the current environment.
  • it: the normal it test function, automatically imported based on the current environment.
  • itCases: a succinct way to test lots of inputs and outputs to a single function.
  • testWeb: a API of web testing utilities, only available in browser environments.
  • testPlaywright: a API of Playwright testing utilities, only available in Playwright test environments.

See the docs under Test, or Package: @augment-vir/test here: https://electrovir.github.io/augment-vir

Caveats

Playwright does not always set the PLAYWRIGHT_TEST env var, especially if you have a playwright config file that imports from TypeScript. If your playwright tests aren't working with this package, try setting PLAYWRIGHT_TEST="1" as an env var before calling Playwright (PLAYWRIGHT_TEST="1" playwright test).

版本与发布记录

@augment-vir/test 共发布 178 个版本,首次发布于 2024/08/28;过去 12 个月发布了 75 个版本。

版本发布日期距今
32.7.0latest2026/10/299 天前
32.6.12026/10/2414 天前
32.6.02026/10/2018 天前
32.5.02026/09/271 个月前
32.4.12026/09/261 个月前
32.4.02026/09/251 个月前

其他发布通道:next → 30.0.2,beta → 32.3.0-beta.0。

关于 @augment-vir/test 的常见问题

@augment-vir/test 是什么?

A universal testing suite that works with Mocha style test runners and Node.js's built-in test runner.

如何安装 @augment-vir/test?

在项目目录运行 npm install @augment-vir/test,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:pngjs(>=7)、sharp(>=0.34)、url-vir(>=2)、pixelmatch(>=5)、element-vir(^27.0.0)、spa-router-vir(>=6)、@playwright/test(*)、@open-wc/testing-helpers(*)、@web/test-runner-commands(*)、@web/test-runner-visual-regression(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@augment-vir/test 支持 TypeScript 吗?

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

@augment-vir/test 支持 ESM 还是 CommonJS?

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

@augment-vir/test 需要什么版本的 Node.js?

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

@augment-vir/test 可以商用吗?

@augment-vir/test 使用 (MIT OR CC0-1.0) 许可。可在 MIT、CC0-1.0 中任选其一遵守。选择 MIT 时,宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@augment-vir/test 的下载量有多少?

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

@augment-vir/test 还在维护吗?

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