Files
cypress/packages/scaffold-config
Zachary Williams 3a8797e54d fix: wire up scaffolded indexHtml to dev servers (#20453)
* fix: wire up scaffolded indexHtml to dev servers

* fix vite tests

* update vuecli-5, fix system tests

* fix vite build error and launchpad test

* remove only

* address comments, remove gitignores

* remove only
2022-03-04 14:16:06 +10:00
..

@packages/scaffold-config

Logic related to scaffolding new projects using launchpad, including detecting component frameworks and bundlers, installing dependencies and creating cypress.config.js files.

We have integrations for popular code generators like Create React App, Next.js and Vue CLI, and ship a cypress.config.js that will work out of the box for those templates.

We will also attempt to scaffold a configuration file for projects using React and Vue projects using Vite and Webpack that are not necessarily created using a code generator.

Supported Frameworks and Libraries

Name Tool Version Dev Server Dev Server Version Library Version (s) Component Adaptor Version Example Project
Create React App 5.x Webpack 5.x React 16, 17 @cypress/react@latest [TODO]
Create React App 4.x Webpack 4.x React 16, React 17 @cypress/react@latest Link
React - Vite 2.x React 16, React 17 @cypress/react@latest Link
Vue - Vite 2.x Vue 3 @cypress/vue@^3.0.0 Link
Vue CLI 4.x Webpack 4.x Vue 2 @cypress/vue@2.0.4 Link
Vue CLI 4.x Webpack 4.x Vue 3 @cypress/vue@latest Link
Vue CLI 5.x Webpack 5.x Vue 2 @cypress/vue@^2.0.0 Covered by other Vue CLI test projects.
Vue CLI 5.x Webpack 5.x Vue 3 @cypress/vue@^3.0.0 Link
Nuxt.js 2.x Webpack 4.x, 5.x Vue 2 @cypress/vue@2.0.4 Link

Adding More Projects

The process for adding a new library/framework/bundler is as follows:

  1. Add your framework in src/frameworks.ts.
  2. Any new dependencies are declared in src/constants.ts. Don't forget to add a description.
  3. Ensure your project has the correct library and bundler detected with a test in test/integration/detect.ts
  4. Add a new project with the correct cypress.config.js and package.json to system-tests/projects. It should be <name>-configured, which is a working example with some specs. Ensure it will run on CI by adding it to component_testing_spec.ts.
  5. Add another project called <name>-unconfigured, which represents the project prior to having Cypress added. This will be used in step 5.
  6. Add a test to scaffold-component-testing.cy.ts to ensure your project has the correct cypress.config.js generated. Use an existing test as a template.

TODO

These should be supported but currently are not configured.

Name Tool Version Dev Server Dev Server Version Library Version (s) Component Adaptor Version Example Project
Next.js 11.x, 12.x Webpack 4.x, 5.x React 16, 17 @cypress/react@latest Link