0

I am trying to apply cucumber BDD with my cypress. But getting below error.

Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat 'C:\Users\admin\LegrandRX_Cucumber\process'
    required by C:\Users\admin\LegrandRX_Cucumber\node_modules\cypress-cucumber-preprocessor\lib\getStepDefinitionsPaths.js

Here is my cypress.json file

{
  "reporter": "cypress-mochawesome-reporter",
  "reporterOptions": {
    "reportDir": "cypress/Reports",
    "charts": true,
    "overwrite": false,
    "html": false,
    "json": true,
    "reportPageTitle": "Legrande Cypress",
    "reportFilename": "Legrande Cypress Test Report",
    "embeddedScreenshots": true,
    "inlineAssets": true
  },
  "defaultCommandTimeout": 30000,
  "retries": {
    "runMode": 1,
    "openMode": 1
  },
  "video": false,
  "scrollBehavior": "nearest",
  "testFiles": "**/*.{feature,features}",
  "chromeWebSecurity": false,
}

And Here is my package.json file

{
  "name": "cypressautomation",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "delete:reportFolder": "rm -rf mochawesome-report/",
    "test:cli": "npm run delete:reportFolder && cypress run",
    "merge:reports": "mochawesome-merge mochawesome-report/*.json > cypress-combined-report.json",
    "create:html:report": "npm run merge:reports && marge --reportDir TestReport cypress-combined-report.json",
    "cy:run": "cypress run",
    "record-test": "cypress run --record --key 18415255-c402-40f0-b983-ab9c3bdf3dc4"
  },
  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": true
  },
  "reporter": "cypress-mochawesome-reporter",
  "reporterOptions": {
    "reportDir": "cypress/Reports",
    "charts": true,
    "reportPageTitle": "My Test Suite",
    "embeddedScreenshots": true,
    "inlineAssets": true
  },
  "video": false,
  "author": "weblylab",
  "license": "ISC",
  "devDependencies": {
    "cypress": "^9.5.0",
    "cypress-cucumber-preprocessor": "^4.3.1",
    "cypress-file-upload": "^5.0.2",
    "cypress-mochawesome-reporter": "^2.2.0",
    "cypress-slack-reporter": "^1.2.1",
    "cypress-xpath": "^1.6.1",
    "faker": "^5.5.3",
    "i": "^0.3.6",
    "mocha": "^8.4.0",
    "mochawesome": "^6.2.2",
    "mochawesome-merge": "^4.2.0",
    "mochawesome-report-generator": "^5.2.0",
    "tsconfig-paths": "^3.9.0"
  },
  "dependencies": {
    "@auth0/auth0-spa-js": "^1.13.6",
    "@types/bluebird": "^3.5.33",
    "@types/lodash": "^4.14.168",
    "chai": "^4.3.0",
    "cypress-iframe": "^1.0.1",
    "cypress-skip-test": "^1.0.0",
    "delay": "^5.0.0",
    "Faker": "^0.7.2",
    "lodash": "^4.17.21",
    "moment": "^2.29.1",
    "resolve-url": "^0.2.1",
    "save": "^2.4.0",
    "source-map-resolve": "^0.6.0",
    "urix": "^0.1.0",
    "xlsx": "^0.17.0"
  }
}

My folder structure, .js file and .feature file

enter image description here

And in my index.js file

const cucumber = require('cypress-cucumber-preprocessor').default

module.exports = (on, config) => {
  on('file:preprocessor', cucumber())
}

Any idea what's wrong here?

Krupal Vaghasiya
  • 536
  • 7
  • 21

0 Answers0