index.js is throwing error when integrated to CypressV10
See original GitHub issueCurrent behavior
I have added the below dependency in my package.json
“devDependencies”: { “@badeball/cypress-cucumber-preprocessor”: “^11.4.0”, “cypress”: “^10.3.0” },
But when running npm run cyopen, getting below issue
Error: The error was thrown while executing your e2e.setupNodeEvents() function:
e2e: { 5 | setupNodeEvents(on, config) {
6 | return require(‘./cypress/plugins/index.js’)(on,config) | ^ 7 | // implement node event listeners here 8 | }, 9 | “specPattern”:“cypress/e2e/**/*.feature” ,
TypeError: require(…) is not a function
This is my index.js
const cucumber = require(“@badeball/cypress-cucumber-preprocessor”).default;
module.exports = (on, config) => {
on(“file:preprocessor”, cucumber());
};
Desired behavior
Test code to reproduce
Versions
- Cypress version: 10.3
- Preprocessor version: 11.4.0
- Node version:
Checklist
- I’ve read the FAQ.
- I’ve read Instructions for logging issues.
- I’m not using
cypress-cucumber-preprocessor@4.3.1
(package name has changed and it is no longer the most recent version, see #689).
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
The code in the above-mentioned screenshot doesn’t even remotely make sense… Why are you requiring
cypress/plugins/index.js
incypress/plugins/index.js
? I recommend that you take a look at the examples. Stop trying to usecypress/plugins/index.js
altogether.@kdubakun, I’ve published v11.5.0 which gives a more thorough error message. Hopefully that’ll give you more insight into your step definitions.