Support @cypress/react18
See original GitHub issue- I’d be willing to implement this feature (contributing guide)
Description
The Cypress team recently published their @cypress/react18
component. We should update @nrwl/react
generators to support this new feature. We would need to add conditional logic to our generators to ensure that any updates are backward compatible with React v17
Motivation
The ReactDom.render
method is no longer supported in React v18, which is bundled with the old mount()
command in @cypress/react
Suggested Implementation
- Add
@cypress/react18
to core dependencies - Update the logic for
@nrwl/react:cypress-component-configuration
generator to check a workspace’s React version. - Update
@nrwl/react:component-test
generator to conditionally use@cypress/react18
. - Create a migration script to automatically update existing component tests.
Alternate Implementations
- Additional changes may be required within
@nrwl/cypress:cypress-component-project
generator
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Cypress Testing fails to build on React version 18 #21381
The plan is to support React 18 very soon once this lands: #22437 which from what I can see only has 1 legitimate...
Read more >@cypress/react - npm
Test React components using Cypress. Latest version: 7.0.2, last published: 22 days ago. Start using @cypress/react in your project by ...
Read more >React Quickstart - Cypress Documentation
Welcome! This tutorial will walk you through creating a React app and using Cypress Component Testing to test it. We assume you are...
Read more >Testing React Apps In 2022 With Cypress: An In-Depth Guide ...
And this doesn't support the Cypress commands like contains() . ... 18-react-cypress-prepare-fixture-or-mock-data.
Read more >Cypress 10.4 is live! Cypress Component... | Facebook
✓ Cypress Component testing now supports React 18 via the cypress/react18 package. ✓ Cypress Component testing now supports Vite 3. Check out the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just noticed this today so thanks for making the issue! Should be able to get to it this week unless you’d like to do it @tyler-morrison. Your implementation is correct just need to check for the react version in the repo and use the dep version required for the generators.
I think you’re right, though technically someone can down level their packages and still run v17. But in that case, we should only generate v18 react code and if people still want to use v17 then they can change the import back to
cypress/react
instead ofcypress/react18
so in this case should check for v17 react versions on in the migration and skip the migration if people are still on v17 and just generate new stuff with v18 support.
Let me know if you need any help or have more questions 😃