Home > Blockchain >  Webpack Compilation Error with Cypress 10 and Cucumber in Angular
Webpack Compilation Error with Cypress 10 and Cucumber in Angular

Time:06-24

I have seen other similar questions in this site, but non of them have a satisfatory solution for me. I don't have any webpack.config.js file since we take the default configuration from angular. Please, see below the corresponding image to have a better sight of my problem.

enter image description here

Other configurations in my project:

package.json

  "cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"json": {
  "enabled": true
},
"stepDefinitions": "**/cypress/e2e/**/*.js",
"step_definitions": "**/cypress/e2e/**/*.js"
},

cypress.config.ts

import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
  return require('./cypress/plugins/index.js')(on, config)
},
specPattern: '**/e2e/**/*.feature',
"supportFile": false,
chromeWebSecurity: false
},
})

CodePudding user response:

Try to install @cypress/webpack-preprocessor

CodePudding user response:

In my case, it was an issue with the latest version of cypress

I'm using

"@badeball/cypress-cucumber-preprocessor": "^11.2.0",
"cypress": "^10.2.0",

First, make sure that you use the latest version of @badeball/cypress-cucumber-preprocessor which fix some compatibilty issues with cypress 10. See https://github.com/badeball/cypress-cucumber-preprocessor/issues/722# for futher info.

Also, latest version of cypress has removed plugin file. In my case, migrating all the code from cypress/plugins/index.js inside setupNodeEvents method solved the issue. See https://docs.cypress.io/guides/references/migration-guide#Plugins-File-Removed

The devil is in the details, it could also be related to your plugin file itself. Maybe you could share it, so that we can help you better. Can you also share what version of "@badeball/cypress-cucumber-preprocessor" you use

Hope it will help you,

  • Related