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

feat: support create-react-app v5 #19434

Merged
merged 3 commits into from
Dec 21, 2021
Merged

feat: support create-react-app v5 #19434

merged 3 commits into from
Dec 21, 2021

Conversation

ZachJW34
Copy link
Contributor

User facing changelog

add support for create-react-app@5

Additional details

create-react-app@5 is stable and @cypress/react doesn't work out of the box. This PR tweaks the @cypress/react/plugins/react-scripts plugin to accommodate for the new changes.

How To Test

I tested this by creating a new app via npx [email protected] <app-name>. I created a branch inside the cypress-component-testing-examples project. To use the new code:

  • checkout this branch and run cd ./react-scripts-5 && yarn
  • In the Cypress repo, run yarn workspace @cypress/react build
  • copy and paste the plugins and dist directories into the react-scripts-5/node_modules/@cypress/react folder
  • Run npx cypress open-ct

I was working on writing a system test for this since our system tests support their own node_modules but I was having trouble getting the correct dependencies to install (I want the equivalent of 0.0.0-development but that doesn't work)

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 21, 2021

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Dec 21, 2021



Test summary

18917 0 218 0Flakiness 2


Run details

Project cypress
Status Passed
Commit e1f2e8d
Started Dec 21, 2021 4:41 PM
Ended Dec 21, 2021 4:52 PM
Duration 11:14 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

commands/net_stubbing_spec.ts Flakiness
1 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"
settings_spec.js Flakiness
1 Settings > file preference panel > loads preferred editor, available editors and shows spinner

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

// depending on the environment (process.env.NODE_ENV). Since we set
// process.env.NODE_ENV = "test", webpack is unable to find any browsers and errors.
// We set BROWSERSLIST_ENV = "development" to override the default NODE_ENV search of browsers.
process.env.BROWSERSLIST_ENV = 'development'
Copy link
Contributor

Choose a reason for hiding this comment

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

should we check to see if BROWSERSLIST_ENV is already defined and use that in case the dev is purposefully adding the envar on their own?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couldn't hurt, I'll add the check

}
}

export const isReactScripts5 = reactScriptsPackageJson.version.startsWith('5')
Copy link
Contributor

Choose a reason for hiding this comment

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

might make this >= v5 so it won't break when v6 comes out

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, I'll convert. Chances are v6 will still break it but no harm in being optimistic

@ZachJW34 ZachJW34 changed the title chore: release create-cypress-tests-v1.3.0 feat: support create-react-app v5 Dec 21, 2021
@ZachJW34 ZachJW34 merged commit 415a7b1 into master Dec 21, 2021
@ZachJW34 ZachJW34 deleted the support-cra-5 branch December 21, 2021 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants