{ "name": "cypress-project", "factory": "./src/generators/cypress-project/cypress-project#cypressProjectGeneratorInternal", "schema": { "$schema": "http://json-schema.org/schema", "$id": "NxCypressProjectGeneratorSchema", "cli": "nx", "title": "Create Cypress Configuration for the workspace", "description": "Create Cypress Configuration for the workspace.", "type": "object", "properties": { "project": { "type": "string", "description": "The name of the frontend project to test.", "$default": { "$source": "projectName" }, "x-priority": "important" }, "baseUrl": { "type": "string", "description": "The address (with the port) which your application is running on." }, "name": { "type": "string", "description": "Name of the E2E Project.", "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What name would you like to use for the e2e project?" }, "directory": { "type": "string", "description": "A directory where the project is placed.", "x-priority": "important" }, "projectNameAndRootFormat": { "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).", "type": "string", "enum": ["as-provided", "derived"] }, "linter": { "description": "The tool to use for running lint checks.", "type": "string", "enum": ["eslint", "none"], "default": "eslint" }, "js": { "description": "Generate JavaScript files rather than TypeScript files.", "type": "boolean", "default": false }, "skipFormat": { "description": "Skip formatting files.", "type": "boolean", "default": false, "x-priority": "internal" }, "setParserOptionsProject": { "type": "boolean", "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.", "default": false }, "standaloneConfig": { "description": "Split the project configuration into `/project.json` rather than including it inside workspace.json.", "type": "boolean", "default": true, "x-deprecated": "Nx only supports standaloneConfig" }, "skipPackageJson": { "type": "boolean", "default": false, "description": "Do not add dependencies to `package.json`.", "x-priority": "internal" }, "bundler": { "description": "The Cypress bundler to use.", "type": "string", "enum": ["vite", "webpack", "none"], "x-prompt": "Which Cypress bundler do you want to use?", "default": "webpack" } }, "required": ["name"], "examplesFile": "Adding Cypress to an existing application requires two options. The name of the e2e app to create and what project that e2e app is for.\n\n```bash\nnx g configuration --name=my-app-e2e --project=my-app\n```\n\nWhen providing `--project` option, the generator will look for the `serve` target in that given project. This allows the [cypress executor](/packages/cypress/executors/cypress) to spin up the project and start the cypress runner.\n\nIf you prefer to not have the project served automatically, you can provide a `--base-url` argument in place of `--project`\n\n```bash\nnx g configuration --name=my-app-e2e --base-url=http://localhost:1234\n```\n\n{% callout type=\"note\" title=\"What about API Projects?\" %}\nYou can also run the `configuration` generator against API projects like a [Nest API](/packages/nest/generators/application#@nx/nest:application).\nIf there is a URL to visit then you can test it with Cypress!\n{% /callout %}\n\n## Using Cypress with Vite.js\n\nNow, you can generate your Cypress project with Vite.js as the bundler:\n\n```bash\nnx g configuration --name=my-app-e2e --project=my-app --bundler=vite\n```\n\nThis generator will pass the `bundler` information (`bundler: 'vite'`) to our `nxE2EPreset`, in your project's `cypress.config.ts` file (eg. `my-app-e2e/cypress.config.ts`).\n\n### Customizing the Vite.js configuration\n\nThe `nxE2EPreset` will then use the `bundler` information to generate the correct settings for your Cypress project to use Vite.js. In the background, the way this works is that it's using a custom Vite preprocessor for your files, that's called on the `file:preprocessor` event. If you want to customize this behaviour, you can do so like this in your project's `cypress.config.ts` file:\n\n```ts\nimport { defineConfig } from 'cypress';\nimport { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';\n\nconst config = nxE2EPreset(__filename, { bundler: 'vite' });\nexport default defineConfig({\n e2e: {\n ...config,\n setupNodeEvents(on, config): {\n config.setupNodeEvents(on);\n // Your settings here\n }\n },\n});\n```\n", "presets": [] }, "description": "Add a Cypress E2E Project.", "hidden": true, "implementation": "/packages/cypress/src/generators/cypress-project/cypress-project#cypressProjectGeneratorInternal.ts", "aliases": [], "path": "/packages/cypress/src/generators/cypress-project/schema.json", "type": "generator" }