- Update `/packages/` links to `/nx-api/` - Convert some unneeded absolute links to relative - Remove leftover examples doc for the already removed `cypress-project` generator <!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #26126
43 lines
2.9 KiB
JSON
43 lines
2.9 KiB
JSON
{
|
|
"name": "component-test",
|
|
"factory": "./src/generators/component-test/component-test#componentTestGenerator",
|
|
"schema": {
|
|
"$schema": "https://json-schema.org/schema",
|
|
"cli": "nx",
|
|
"$id": "NxReactCypressComponentTest",
|
|
"title": "Add Cypress component test",
|
|
"description": "Add a Cypress component test for a component.",
|
|
"type": "object",
|
|
"examples": [
|
|
{
|
|
"command": "nx g @nx/react:component-test --project=my-react-project --component-path=src/lib/fancy-component.tsx",
|
|
"description": "Create a cypress component test for FancyComponent"
|
|
}
|
|
],
|
|
"properties": {
|
|
"project": {
|
|
"type": "string",
|
|
"description": "The name of the project the component is apart of",
|
|
"x-dropdown": "projects",
|
|
"x-prompt": "What project is this component apart of?",
|
|
"x-priority": "important"
|
|
},
|
|
"componentPath": {
|
|
"type": "string",
|
|
"description": "Path to component, from the project source root",
|
|
"x-prompt": "What is the path to the component?",
|
|
"x-priority": "important"
|
|
}
|
|
},
|
|
"required": ["project", "componentPath"],
|
|
"examplesFile": "{% callout type=\"caution\" title=\"Can I use component testing?\" %}\nReact component testing with Nx requires **Cypress version 10** and up.\n\nYou can migrate with to v11 via the [migrate-to-cypress-11 generator](/nx-api/cypress/generators/migrate-to-cypress-11).\n\nThis generator is for Cypress based component testing.\n\nIf you're wanting to create Cypress tests for a Storybook story, then check out the [component-cypress-spec generator docs](/nx-api/react/generators/component-cypress-spec)\n\nIf you're wanting to create Storybook stories for a component, then check out the [stories generator docs](/nx-api/react/generators/stories) or [component-story generator docs](/nx-api/react/generators/component-cypress-spec)\n\n{% /callout %}\n\nThis generator is used to create a Cypress component test file for a given React component.\n\n```shell\nnx g @nx/react:component-test --project=my-cool-react-project --componentPath=src/my-fancy-button.tsx\n```\n\nTest file are generated with the `.cy.` suffix. this is to prevent colliding with any existing `.spec.` files contained in the project.\n\nIt's currently expected the generated `.cy.` file will live side by side with the component. It is also assumed the project is already setup for component testing. If it isn't, then you can run the [cypress-component-project generator](/nx-api/react/generators/cypress-component-configuration) to set up the project for component testing.\n",
|
|
"presets": []
|
|
},
|
|
"description": "Generate a Cypress component test for a React component",
|
|
"hidden": false,
|
|
"implementation": "/packages/react/src/generators/component-test/component-test#componentTestGenerator.ts",
|
|
"aliases": [],
|
|
"path": "/packages/react/src/generators/component-test/schema.json",
|
|
"type": "generator"
|
|
}
|