I have a React component library bundled using Rollup. I am trying to setup React component testing with Cypress on it but I it fails.
I run the command npx create-cypress-tests --component-tests which installs dependencies and creates the needed files. However, when I run npx cypress open-ct to open Cypress I get the following error
Error: The plugins file is missing or invalid.
Your `pluginsFile` is set to `/Users/mustafa.mansour/dev/gel/cypress/plugins/index.js`, but either the file is missing, it contains a syntax error, or threw an error when required. The `pluginsFile` must be a `.js`, `.ts`, or `.coffee` file.
Or you might have renamed the extension of your `pluginsFile`. If that's the case, restart the test runner.
Please fix this, or set `pluginsFile` to `false` if a plugins file is not necessary for your project.
at Object.get (/Users/mustafa.mansour/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/errors.js:988:15)
at EventEmitter.<anonymous> (/Users/mustafa.mansour/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/index.js:154:21)
at EventEmitter.emit (events.js:315:20)
at ChildProcess.<anonymous> (/Users/mustafa.mansour/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:19:22)
at ChildProcess.emit (events.js:315:20)
at emit (internal/child_process.js:903:12)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
{
isCypressErr: true,
type: 'PLUGINS_FILE_ERROR',
details: "Error: Cannot find module 'nollup/lib/dev-middleware'\n" +
'Require stack:\n' +
'- /Users/mustafa.mansour/dev/gel/node_modules/@cypress/rollup-dev-server/dist/startServer.js\n' +
'- /Users/mustafa.mansour/dev/gel/node_modules/@cypress/rollup-dev-server/dist/index.js\n' +
'- /Users/mustafa.mansour/dev/gel/node_modules/@cypress/rollup-dev-server/index.js\n' +
'- /Users/mustafa.mansour/dev/gel/cypress/plugins/index.js\n' +
'- /Users/mustafa.mansour/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js\n' +
'- /Users/mustafa.mansour/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/index.js\n' +
' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:887:15)\n' +
' at Function.Module._resolveFilename (/Users/mustafa.mansour/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/tsconfig-paths/lib/register.js:75:40)\n' +
' at Module._load (internal/modules/cjs/loader.js:732:27)\n' +
' at Function.f._load (electron/js2c/asar_bundle.js:5:12789)\n' +
' at Module.require (internal/modules/cjs/loader.js:959:19)\n' +
' at require (internal/modules/cjs/helpers.js:88:18)\n' +
' at Object.<anonymous> (/Users/mustafa.mansour/dev/gel/node_modules/@cypress/rollup-dev-server/dist/startServer.js:18:42)\n' +
' at Module._compile (internal/modules/cjs/loader.js:1078:30)\n' +
' at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)\n' +
' at Module.load (internal/modules/cjs/loader.js:935:32)\n' +
' at Module._load (internal/modules/cjs/loader.js:776:14)\n' +
' at Function.f._load (electron/js2c/asar_bundle.js:5:12789)\n' +
' at Module.require (internal/modules/cjs/loader.js:959:19)\n' +
' at require (internal/modules/cjs/helpers.js:88:18)\n' +
' at Object.<anonymous> (/Users/mustafa.mansour/dev/gel/node_modules/@cypress/rollup-dev-server/dist/index.js:13:23)\n' +
' at Module._compile (internal/modules/cjs/loader.js:1078:30)'
}
Error: The plugins file is missing or invalid.
Your `pluginsFile` is set to `/Users/mustafa.mansour/dev/gel/cypress/plugins/index.js`, but either the file is missing, it contains a syntax error, or threw an error when required. The `pluginsFile` must be a `.js`, `.ts`, or `.coffee` file.
Or you might have renamed the extension of your `pluginsFile`. If that's the case, restart the test runner.
Please fix this, or set `pluginsFile` to `false` if a plugins file is not necessary for your project.
at Object.get (/Users/mustafa.mansour/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/errors.js:988:15)
at EventEmitter.<anonymous> (/Users/mustafa.mansour/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/index.js:154:21)
at EventEmitter.emit (events.js:315:20)
at ChildProcess.<anonymous> (/Users/mustafa.mansour/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:19:22)
at ChildProcess.emit (events.js:315:20)
at emit (internal/child_process.js:903:12)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
The versions I have are
"@cypress/react": "^5.4.0",
"@cypress/rollup-dev-server": "^1.1.0",
"cypress": "^7.2.0"