Closed
Description
Current behavior
Use cypress with the @cypress/react/plugins/next
plugin.
When run cypress, it shows the errors
TypeError: Cannot read property 'length' of undefined
at getBaseWebpackConfig (/Users/Hank.Lin/playground/nextjs-starter-app/node_modules/next/dist/build/webpack-config.js:8:575)
at getNextWebpackConfig (/Users/Hank.Lin/playground/nextjs-starter-app/node_modules/@cypress/react/plugins/next/file-preprocessor.js:16:35)
at async getCachedWebpackPreprocessor (/Users/Hank.Lin/playground/nextjs-starter-app/node_modules/@cypress/react/plugins/next/file-preprocessor.js:59:26)
at async Object.handler (/Users/Hank.Lin/playground/nextjs-starter-app/node_modules/@cypress/react/plugins/next/file-preprocessor.js:70:26)
Desired behavior
It should run the tests correctly.
Test code to reproduce
install steps
npx create-next-app nextjs-starter-app
npm install --save-dev cypress @cypress/react
in cypress/plugins/index.js
module.exports = (on, config) => {
require('@cypress/react/plugins/next')(on, config);
}
Versions
cypress: 6.8.0
@cypress/react: 4.6.4
next: 10.1.2