question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

index.js is throwing error when integrated to CypressV10

See original GitHub issue

Current 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:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
badeballcommented, Jul 12, 2022

The code in the above-mentioned screenshot doesn’t even remotely make sense… Why are you requiring cypress/plugins/index.js in cypress/plugins/index.js ? I recommend that you take a look at the examples. Stop trying to use cypress/plugins/index.js altogether.

0reactions
badeballcommented, Jul 13, 2022

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migration to v10.3.1 - Cypress configuration error Cannot find ...
Error Your C:\Users\XX\icm-ui\apps\icm-web-cypress-ui\plugins\index.js file threw an error. Please ensure your pluginsFile is valid and ...
Read more >
Error on calling plugins/index.js to Cypress 10 version
I am trying to import plugins/index.
Read more >
Error Messages | Cypress Documentation
We found an error preparing your test file. This message means that Cypress encountered an error when compiling and/or bundling your test file....
Read more >
Migrating Test Automation Suite To Cypress 10 - LambdaTest
json and cypress.config.js files, an error will be thrown. cypres configuration. Mandatory configuration file. Before Cypress 10.0, the ...
Read more >
cypress-io/cypress - Gitter
tests/cypress/support/index.js Module build failed (from ... sure how to use it - specifying browser path after --browser from the .zip file throws error....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found