-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ Flakiness
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' |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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:cd ./react-scripts-5 && yarn
yarn workspace @cypress/react build
plugins
anddist
directories into thereact-scripts-5/node_modules/@cypress/react
foldernpx 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 of0.0.0-development
but that doesn't work)PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?