Files
cypress/packages/scaffold-config
Blue F 8ff38cdb01 feat: Create public Cypress.ensure API for use with custom queries (#24697)
* fix: Improve TypeScript support for custom queries

* Typo fix

* Fix TS more

* Move 'ensures' off of cy and onto Cypress

* Type fixes

* One missed replacement

* Test fixes

* Properly pass in  to ensureRunnable

* Add .eslintignores to quiet down warnings

* Review feedback

* Update cli/types/cypress.d.ts

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2022-11-29 09:34:34 -06: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 Version Dev Server Version Library Component Adaptor 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, 17 @cypress/react@latest Link
React - Vite 2.x React 16, 17 @cypress/react@latest Link
Vue - Vite 2.x Vue 3 @cypress/vue@latest Link
Vue CLI 4.x Webpack 4.x Vue 2 @cypress/vue2@latest Link
Vue CLI 4.x Webpack 4.x Vue 3 @cypress/vue@latest Link
Vue CLI 5.x Webpack 5.x Vue 2 @cypress/vue2@latest Covered by other Vue CLI test projects.
Vue CLI 5.x Webpack 5.x Vue 3 @cypress/vue@latest Link
Nuxt.js 2.x Webpack 4.x, 5.x Vue 2 @cypress/vue2@latest Link

TODO

These should be supported but currently are not configured.

Name Version Dev Server Version Library Component Adaptor Example Project
Next.js 11.x, 12.x Webpack 4.x, 5.x React 16, 17 @cypress/react@latest 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/unit/detect.spec.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.