@briebug/cypress-schematic

中文文档
5.0.1发布于 2021/07/27MITCommonJS近 30 天下载 2690

Add cypress to an Angular CLI project

此软件包已被标记为弃用

no longer supported. visit https://github.com/cypress-io/cypress/tree/develop/npm/cypress-schematic

原始使用文档
文档目录10 节
  1. ⛔️ DEPRECATED ⛔️
  2. This Angular Schematic has been adopted by Cypress and will…
  3. Thank you
  4. Usage 🚀
  5. Issues
  6. Development 🛠
  7. Getting started
  8. E2E testing
  9. Unit Testing
  10. Reset the sandbox

⛔️ DEPRECATED ⛔️ Cypress Angular Schematic

npm (scoped) Downloads

Cypress Schematic Logo

⛔️ DEPRECATED ⛔️

This Angular Schematic has been adopted by Cypress and will be maintained in their repository by the Cypress Team moving forward. Head over to https://github.com/cypress-io/cypress/tree/develop/npm/cypress-schematic for more info, and feel free to contribute!

Thank you

Thank you to the contributors of this library @muuvmuuv, @konstantindenerz, @cexbrayat, @MrCube42, @devinshoemaker, @Ant59, @NileshPatel17, @timtim5174, @tabuckner, and @bovandersteene. Thank you @schuchard for pioneering the sandbox approach for developing Angular schematics.


Add Cypress to an Angular CLI project

This schematic will:

  • install Cypress, its dependencies, and new scripts
  • add necessary files for Cypress to work with Angular & Typescript
  • prompt for removal of Protractor files and configuration

Usage 🚀

Run as one command in an Angular CLI app directory. Note this will add the schematic as a dependency to your project.

ng add @briebug/cypress-schematic

With the custom builder installed, you can run cypress with the following commands:

ng e2e
ng run {your-project-name}:cypress-open

These two commands do the same thing. They will launch the (Electron) Cypress Test Runner in watch mode.

ng run {your-project-name}:cypress-run

This command will open the (Electron) Cypress Test Runner and run your tests one time, with output to your terminal.

Options

OptionDescription
addCypressTestScriptsThis will add Cypress open and run command scripts to your package.json. Include --addCypressTestScripts in your ng add command.
noBuilderThis will skip the builder addition, leaving the angular.json file unmodified and requiring you to run Cypress from the command line or through your IDE. Include --noBuilder in your ng add command.

Issues

Issues with this schematic can be filed here.

If you want to contribute (or have contributed in the past), feel free to add yourself to the list of contributors in the package.json before you open a PR!

Development 🛠

Getting started

⚙ Node.js and npm are required for the scripts. Make sure it's installed on your machine.

⬇ Install the dependencies for the schematic and the sandbox application

npm i && cd sandbox && npm i && cd ..

🖇 Link the schematic in the sandbox to run locally

npm run link:sandbox

🏃 Run the schematic

npm run build:clean:launch

E2E testing

Execute the schematic against the sandbox. Then run linting, unit & e2e tests and a prod build in the sandbox.

npm run test

Unit Testing

Run the unit tests using Jasmine as a runner and test framework.

npm run test:unit

Reset the sandbox

Running the schematic locally makes file system changes. The sandbox is version controlled so that viewing a diff of the changes is trivial. After the schematic has run locally, reset the sandbox with the following.

npm run clean

版本与发布记录

@briebug/cypress-schematic 共发布 24 个版本,首次发布于 2019/01/24;过去 12 个月发布了 0 个版本。

版本发布日期距今
5.0.1latest2021/07/275 年前
5.0.02021/04/235 年前
4.4.02020/12/085 年前
4.3.02020/11/036 年前
4.2.42020/10/296 年前
4.2.32020/10/166 年前

关于 @briebug/cypress-schematic 的常见问题

@briebug/cypress-schematic 是什么?

Add cypress to an Angular CLI project注意:该包已被作者标记为弃用——no longer supported. visit https://github.com/cypress-io/cypress/tree/develop/npm/cypress-schematic

如何安装 @briebug/cypress-schematic?

在项目目录运行 npm install @briebug/cypress-schematic,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:cypress(^7.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@briebug/cypress-schematic 支持 TypeScript 吗?

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

@briebug/cypress-schematic 支持 ESM 还是 CommonJS?

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

@briebug/cypress-schematic 需要什么版本的 Node.js?

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

@briebug/cypress-schematic 可以商用吗?

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

@briebug/cypress-schematic 的下载量有多少?

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

@briebug/cypress-schematic 还在维护吗?

最新版本 5.0.1 发布于 2021/07/27(5 年前);至今共发布 24 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/01/24。作者已将其标记为弃用,新项目建议寻找替代方案。