Setting up Cypress using webpack 5 and react-scripts
See original GitHub issueCurrent behavior
I am facing an issue with setting up Cypress with webpack 5. When I run the test end-to-end It works properly, but when I run the component test (cypress run-ct
) I got an error. Follow the errro below:
What I could notice is I’m using the react-scripts
library and it is using webpack 4 under the hood. I tried to use webpack-5-react-scripts
but it didn’t work as well.
Anyone has already faced this before?
My package.json My webpack config My Cypress plugin
Debug logs
No response
Cypress Version
9.0.0
Package Manager
yarn
Operating system
Mac
Other
Node version: 14.18.1 Thanks in advance!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:17 (5 by maintainers)
Top Results From Across the Web
webpack 5 custom react project throwing error Cypress ...
if i use create-react-app then setup works fine only i am facing issue with webpack configuration option . Kindly let me know any...
Read more >Component Testing Config
When you launch Cypress for the first time in a project, the app will automatically guide you through setup and configuration. You don't...
Read more >Unit testing React components in Cypress without CRA and ...
1. Install Cypress · 2. Add cypress.json · 3. Update support bindings · 4. Configure the plugins · 5. Write your tests ·...
Read more >cypress/webpack-preprocessor
Cypress preprocessor for bundling JavaScript via webpack. Latest version: 5.16.0, last published: 5 days ago.
Read more >Problem setting up Cypress component tests for CRA with ...
This worked for me. Remove cypress.config.js and cypress folder; Initialize the the cypress config and choose create-react-app fram.
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
That is my use case also, it started today.
Old installation/yarn.lock works just fine.
In a fresh project, or deleting
yarn.lock
thenyarn install
, it fails with the error:TypeError: Cannot read properties of undefined (reading 'uid') at Object.statSync (/foo/bar/Library/Caches/Cypress/8.7.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/graceful-fs/polyfills.js:303:17)
Looks like
@cypress/webpack-dev-server
doesn’t support webpack v5 just yet. See https://github.com/cypress-io/cypress/blob/develop/npm/webpack-dev-server/src/webpackDevServerFacts.ts