Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking: remove support for create react app for component testing as it is no longer maintained #30558

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

AtofStryker
Copy link
Contributor

@AtofStryker AtofStryker commented Nov 6, 2024

Additional details

Create React App is de-facto abandoned and unsupported. Because of this, Cypress has chosen to remove CRA support for Component Testing in Cypress 14. This means that create-react-app users will need to use either webpack or vite to bundler their component tests. webpack support is supported with create-react-app if a user choses to eject their app.

  • What happens when using prepublished binary against scaffolded CRA project? Can I eject?

If starting cypress without doing any migration, this error will throw in the cypress config

Screenshot 2024-11-06 at 4 20 57 PM

However, users can migrate via npm run eject with create-react-app, which will generate a webpack config. If users change their config from:

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  component: {
    devServer: {
      framework: 'create-react-app',
      bundler: 'webpack',
    },
  },
})

to

process.env.NODE_ENV = 'development'
const { defineConfig } = require('cypress')
const webpackConfig = require('./config/webpack.config.js')

module.exports = defineConfig({
  component: {
    devServer: {
      framework: 'react',
      bundler: 'webpack',
      webpackConfig: webpackConfig('development'),
    },
  },
})

this does work
Screenshot 2024-11-06 at 4 57 07 PM

  • Does scaffolding work with new projects?

It does work with new projects as react is selected and webpack is detected. However, a user will need to eject the application and point to the webpack config as shown above. Otherwise, the config will throw an error which is expected

  • Provide options in the migration guide

Steps to test

Testing against prepublished binary to verify migration steps work as expected

How has the user experience changed?

PR Tasks

Copy link

cypress bot commented Nov 6, 2024

cypress    Run #58281

Run Properties:  status check passed Passed #58281  •  git commit b4aeb278b2: breaking: remove support for create react app for component testing as it is no ...
Project cypress
Branch Review breaking/remove_create_react_app
Run status status check passed Passed #58281
Run duration 09m 59s
Commit git commit b4aeb278b2: breaking: remove support for create react app for component testing as it is no ...
Committer AtofStryker
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 1
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 667
View all changes introduced in this branch ↗︎
UI Coverage  38.03%
  Untested elements 132  
  Tested elements 81  
Accessibility  92.06%
  Failed rules  3 critical   7 serious   1 moderate   1 minor
  Failed elements 540  

@AtofStryker AtofStryker force-pushed the breaking/remove_create_react_app branch 2 times, most recently from 825bcc4 to b2ddc9c Compare November 6, 2024 17:24
@AtofStryker AtofStryker linked an issue Nov 6, 2024 that may be closed by this pull request
@AtofStryker AtofStryker self-assigned this Nov 6, 2024
@AtofStryker AtofStryker force-pushed the breaking/remove_create_react_app branch 3 times, most recently from 9fd62df to bee6912 Compare November 6, 2024 23:13
@AtofStryker AtofStryker marked this pull request as ready for review November 6, 2024 23:42
@AtofStryker AtofStryker added type: breaking change Requires a new major release version npm: @cypress/react @cypress/react package issues labels Nov 6, 2024
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some notes, nothing I think that's blocking. A lot of code removed!

packages/launchpad/cypress/e2e/project-setup.cy.ts Outdated Show resolved Hide resolved
packages/launchpad/cypress/e2e/project-setup.cy.ts Outdated Show resolved Hide resolved
Comment on lines -1 to -8
module.exports = {
component: {
devServer: {
framework: 'create-react-app',
bundler: 'webpack',
},
},
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not need a replacement with another framework?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it gets replaced by react and webpack which we already support. but this file in general looks to be left over from when sessionAndOrigin went Ga so its dead code

Comment on lines 3 to 5
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why we'd leave this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its to test an ejected version of create react app, which is really just a react/webpack application. I'd like to keep it because its almost a system test around a working migration away from cra

@AtofStryker AtofStryker force-pushed the breaking/remove_create_react_app branch from bee6912 to b4aeb27 Compare November 7, 2024 18:20
@AtofStryker AtofStryker merged commit 37b944f into release/14.0.0 Nov 7, 2024
81 of 82 checks passed
@AtofStryker AtofStryker deleted the breaking/remove_create_react_app branch November 7, 2024 23:02
@jennifer-shehane jennifer-shehane mentioned this pull request Dec 3, 2024
28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
npm: @cypress/react @cypress/react package issues type: breaking change Requires a new major release version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove support for Create React App (CRA)
2 participants