This plugin provides generators to initialize Cypress testing for Nx workspaces, with a focus on component testing for Angular applications and libraries. It automates configuration, dependency management, and code modifications to streamline Cypress setup and integration. The plugin also includes utilities for coercing configurations and dependencies to ensure compatibility and best practices.
Add the package to your workspace:
yarn add @rxap/plugin-cypress
Execute the init generator:
yarn nx g @rxap/plugin-cypress:init
First, add the init generator to the workspace schematic configuration and create all required files
nx g @rxap/plugin-cypress:init
Use the cypress component configuration generator to add the required files and configurations to an angular library
nx g @nx/angular:cypress-component-configuration --buildTarget cypress:build --project $projectName
Use the init library generator to setup all required configurations
nx g @rxap/plugin-cypress:init-library --project $projectName
init generator
nx g @rxap/plugin-cypress:init
Option | Type | Default | Description |
---|---|---|---|
project | string | ||
projects | array | ||
skipFormat | boolean | false | |
overwrite | boolean | false | Whether to overwrite existing files |
skipProjects | boolean | false | Whether to skip executing project specific initialization |
init-library generator
nx g @rxap/plugin-cypress:init-library
Option | Type | Default | Description |
---|---|---|---|
project | string | ||
projects | array | ||
skipFormat | boolean | false | |
overwrite | boolean | false | Whether to overwrite existing files |
skipProjects | boolean | false | Whether to skip executing project specific initialization |
component | boolean | false | Whether to setup cypress component testing |
generateTests | boolean | Whether to generate tests for the components | |
buildTarget | string | A build target used to configure Cypress component testing in the format of `project:target[:configuration]`. The build target should be an angular app. If not provided we will try to infer it from your projects usage. |
init-application generator
nx g @rxap/plugin-cypress:init-application
Option | Type | Default | Description |
---|---|---|---|
project | string | ||
projects | array | ||
skipFormat | boolean | false | |
overwrite | boolean | false | Whether to overwrite existing files |
skipProjects | boolean | false | Whether to skip executing project specific initialization |