# @csvtuda/cypress-xray-plugin 中文文档

规范地址：https://npmcn.com/package/%40csvtuda/cypress-xray-plugin/

版本：8\.6\.8
npm 元数据更新时间：2026-10-21T23:12:51.536Z
中文译文更新时间：2026-11-11T03:33:03.747Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40csvtuda/cypress-xray-plugin
原文对照：https://npmcn.com/package/%40csvtuda/cypress-xray-plugin/?lang=original
项目主页：https://csvtuda.github.io/docs/cypress-xray-plugin/
源码仓库：https://github.com/csvtuda/cypress-xray-plugin

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：606 kB，202 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=18\.0\.0
- 运行依赖：5 个
- peer 依赖：cypress \>=10\.0\.0 \< 17，@badeball/cypress-cucumber-preprocessor \>=17
- 首次发布：2025-09-24T21:01:10.128Z
- 最新版本发布：2026-10-21T23:12:51.143Z
- 近 30 天下载量：11526（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：11（近 12 个月 8 个）

## 中文简介

用于上传测试结果到 Xray 的 Cypress 插件( Jira 测试管理)

## 安装

```sh
npm install @csvtuda/cypress-xray-plugin
```

也可以使用：`pnpm add @csvtuda/cypress-xray-plugin`、`yarn add @csvtuda/cypress-xray-plugin`、`bun add @csvtuda/cypress-xray-plugin`

## README

# [![Cypress Xray Plugin](https://npmcn.com/package/%40csvtuda/cypress-xray-plugin/logo.svg)](https://csvtuda.github.io/docs/cypress-xray-plugin/)

[![npm version](https://img.shields.io/npm/v/cypress-xray-plugin?style=flat-square)](https://www.npmjs.com/package/cypress-xray-plugin) [![npm downloads](https://img.shields.io/npm/dm/cypress-xray-plugin?style=flat-square)](https://www.npmjs.com/package/cypress-xray-plugin) [![open GitHub issues](https://img.shields.io/github/issues-raw/csvtuda/cypress-xray-plugin?style=flat-square)](https://github.com/csvtuda/cypress-xray-plugin/issues?q=is%3Aissue+is%3Aopen) [![unaddressed GitHub issues](https://img.shields.io/github/issues-search/csvtuda/cypress-xray-plugin?label=unaddressed%20issues&query=no%3Aassignee%20is%3Aopen&style=flat-square)](https://github.com/csvtuda/cypress-xray-plugin/issues?q=is%3Aissue+is%3Aopen+no%3Aassignee)

# Cypress Xray 插件

> Xray 集成的 Cypress 插件. 支持Xray服务器/DC和Xray Cloud.

特征包括:

-   上传测试结果到 Xray
    -   附加截图作为测试执行证据
    -   附加网络请求作为测试执行证据
    -   附加视频测试执行问题
    -   现有测试执行和测试计划问题
-   CI/CD 备妥
    -   没有硬编码的证书
-   木瓜整合
    -   将步骤定义同步/上载到Xray
    -   如上所述,结果上传

## 快速设置

运行以下命令将插件添加到您的工程中 :

```sh
npm install --save-dev @csvtuda/cypress-xray-plugin
```

然后,在 Cypress 项目配置中配置插件 :

```js
import { configureXrayPlugin } from "@csvtuda/cypress-xray-plugin";

export default defineConfig({
    e2e: {
        async setupNodeEvents(on, config) {
            await configureXrayPlugin(on, config, {
                jira: {
                    projectKey: "PRJ",
                    url: "https://example.org",
                },
            });
        },
    },
});
```

请确定您也配置您的 [全权证书](https://csvtuda.github.io/docs/cypress-xray-plugin/configuration/authentication) 给Jira/Xray的.

要让插件上传测试结果, [链接您的测试大小写](https://csvtuda.github.io/docs/cypress-xray-plugin/guides/targetingExistingIssues) 至 Xray 测试,在测试标题中指定相应的问题密钥 :

```js
it("PRJ-42 My test", () => {
    // ...
});
```

> \[注\] 此插件只在通过 CLI(即. `npx cypress run`) (中文(简体) ).

## 文档

请 [访问文件](https://csvtuda.github.io/docs/cypress-xray-plugin/) 以找出如何充分设置插件,包括完整的选项列表.

## 问题

如果你遇到怪异的行为 或者觉得一个特征不见了 随便创造一个 [GitHub 问题](https://github.com/csvtuda/cypress-xray-plugin/issues)。 。 。 .

## 常见问题

### @csvtuda/cypress-xray-plugin 是什么？

用于上传测试结果到 Xray 的 Cypress 插件\( Jira 测试管理\)

### 如何安装 @csvtuda/cypress-xray-plugin？

在项目目录运行 npm install @csvtuda/cypress-xray-plugin，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：cypress（\>=10\.0\.0 \< 17）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @csvtuda/cypress-xray-plugin 支持 TypeScript 吗？

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

### @csvtuda/cypress-xray-plugin 支持 ESM 还是 CommonJS？

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

### @csvtuda/cypress-xray-plugin 需要什么版本的 Node\.js？

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

### @csvtuda/cypress-xray-plugin 可以商用吗？

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

### @csvtuda/cypress-xray-plugin 的下载量有多少？

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

### @csvtuda/cypress-xray-plugin 还在维护吗？

最新版本 8\.6\.8 发布于 2026/10/22（20 天前）；至今共发布 11 个版本，其中过去 12 个月发布了 8 个；首次发布于 2025/09/25。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

