0
votes

I'm trying to run Cypress BDD test suites with Browserstack but i kept getting this error CYPRESS_RUN_FAILEDCypress failed to run. Hide stack trace [-] The plugins file is missing or invalid.

Your pluginsFile is set to .\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.

Error: Cannot find module 'cypress-cucumber-preprocessor' Require stack:

  • .\cypress\plugins\index.js
  • \cypress_package\4.12.1\app\packages\server\lib\plugins\child\run_plugins.js
  • \cypress_package\4.12.1\app\packages\server\lib\plugins\child\index.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:798:15) at Module._load (internal/modules/cjs/loader.js:691:27) at Module._load (electron/js2c/asar.js:717:26) at Function.Module._load (electron/js2c/asar.js:717:26) at Module.require (internal/modules/cjs/loader.js:853:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (.\cypress\plugins\index.js:2:18) at Module._compile (internal/modules/cjs/loader.js:968:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:986:10) at Module.load (internal/modules/cjs/loader.js:816:32) at Module._load (internal/modules/cjs/loader.js:728:14) at Module._load (electron/js2c/asar.js:717:26) at Function.Module._load (electron/js2c/asar.js:717:26) at Module.require (internal/modules/cjs/loader.js:853:19) at require (internal/modules/cjs/helpers.js:74:18) at module.exports (\cypress_package\4.12.1\app\packages\server\lib\plugins\child\run_plugins.js:208:15)

cypress run process exited with code 1 cypress run failed, exiting with code: 1

After following the answer suggestion, it seems it cannot read my stepDef and Page class files; enter image description here

1

1 Answers

0
votes

From the stack trace, I see:

Cannot find module 'cypress-cucumber-preprocessor' Require stack

Looks like you're missing the dependency.

Cypress execution on BrowserStack requires you to explicitly mention the npm packages required by the test in the browserstack.json file.

Here's the documentation link: https://www.browserstack.com/docs/automate/cypress/npm-packages