Skip to main content

init

@ensono-stacks/cypress:init

Create a cypress test project for your chosen application

The init generator adds cypress e2e tests to the application you choose.

Usage

nx g @ensono-stacks/cypress:init

Upon calling the init generator you will be presented with the following question:

  • What app would you like to generate a test project for?
  • The name of the existing application to generate a test project for

Command line arguments

The following command line arguments are available:

OptionDescriptionType
--projectThe name of the application to generate a test project forstring

Generator Output

The init generator will create a new test project within your chosen application containing an example test and predefined configuration for the monorepo and the individual test project.

Generated files
.
├── apps
│ ├── <app-name>
│ │ ├── cypress
│ │ │ ├── e2e
│ │ │ │ ├── example.cy.ts #Example tests using cypress
│ │ │ ├── fixtures
│ │ │ │ ├── example.json #Example fixture/test data
│ │ │ ├── support
│ │ │ │ ├── commands.ts #Example custom commands for cypress
│ │ │ │ ├── e2e.ts #Configuration for cypress and test reporting
│ │ │ ├── tsconfig.json #Typescript configuration for cypress
│ │ ├── project.json #Updated with target for cypress and reporting
│ │ ├── tsconfig.json #Typescript configuration updated for cypress exclusions
└── cypress.config.base.ts #Shared cypress configuration across projects
note

Visit the Testing with cypress documentation for further details!