-
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 React 19 for Cypress Component Testing #30651
Conversation
cypress Run #58529
Run Properties:
|
Project |
cypress
|
Branch Review |
feat/support_react_19
|
Run status |
Passed #58529
|
Run duration | 17m 44s |
Commit |
cd07b42d6c: feat: support react 19 for component testing with cypress/react [run ci]
|
Committer | AtofStryker |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
4
|
Pending |
1103
|
Skipped |
0
|
Passing |
15855
|
View all changes introduced in this branch ↗︎ |
Warning
No Report: Something went wrong and we could not generate a report for the Application Quality products.
f6b67a2
to
e1d3d55
Compare
e1d3d55
to
cd07b42
Compare
@@ -32,11 +32,11 @@ | |||
"vite-plugin-require-transform": "1.0.12" | |||
}, | |||
"peerDependencies": { | |||
"@types/react": "^18", | |||
"@types/react-dom": "^18", | |||
"@types/react": "^18 || ^19", |
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.
these peer dependencies are slightly off since they don't match the release candidate semver, which is not a problem with the shipped binary but could cause problems if someone is trying to install @cypress/react
with the react 19 release candidate. I don't see anyone actually needing to do this, and especially since React 19 isn't officially released yet, I am hesitant to make the change here.
Additional details
Adds React 19 (Not yet officially released) and React 19 Release Candidate support to component. This PR is prematurely supporting React 19 for Component testing as we do not anticipate massive release candidate API changes with React 19. React 19 Release Candidate support is also needed to support Next 15 (not 15 RC, but actual 15).
Testing the build binaries works as expected against a sample React 19 project. This works OOTB since the
ReactDOM.render()
changes merged upstream intocypress/react
in #30590, so no custom test harness is needed 🎉Using the React 19 RC today with Cypress 13x
Since React 19 is not supported today, framework detection does not work correctly and scaffolded dependencies are not satisfied
The
cypress/react
test harness also does not work asReactDOM.render()
was removed in React 19. The user can usecypress/react18
to get this to work, but that is not obvious.Using the React 19 RC on this branch
Dependencies are automatically detected and satisfied. This is partially due to use detecting the release candidate, which I think we can announce we will remove once React 19 is officially released without releasing a breaking change. This requires further discussion
The
cypress/react
test harness works with 19 naturally because it uses the rendering methods used by react 18, which isroot.render()
from theReactDOM/client
package so no change is necessarySteps to test
Highly recommend setting up a sample React 19 project. This is likely easiest with setting up a React project with Vite and then updating the React dependencies following this guide.
How has the user experience changed?
Users can now use Cypress Component Testing with React 19 in Cypress 14
PR Tasks
cypress-documentation
? chore: add docs for react 19 and next.js 15 cypress-documentation#6008type definitions
?