Cypress-cucumber-preprocessor: TypeError: Path must be a string. Received undefined

Created on 23 Jul 2019  路  8Comments  路  Source: TheBrainFamily/cypress-cucumber-preprocessor

Hello :)

I just tried out your example from
https://github.com/TheBrainFamily/cypress-cucumber-webpack-typescript-example

I executed "npm install" and then tried to run the tests "npm run test" and the result was

Oops...we found an error preparing this test file:

  cypress\integration\WebPack.feature

The error was:

./cypress/integration/WebPack.feature
Module build failed (from ./node_modules/cypress-cucumber-preprocessor/loader.js):
TypeError: Path must be a string. Received undefined
 @ multi ./cypress/integration/WebPack.feature main[0]

This occurred while Cypress was compiling and bundling your test code. This is usually caused by:

- A missing file or dependency
- A syntax error in the file or one of its dependencies

Fix the error in your code and re-run your tests.

Br, bene

Most helpful comment

We have a similar problem with version 1.13.0:

Module build failed (from ./node_modules/cypress-cucumber-preprocessor/loader.js):
TypeError: Cannot read property 'replace' of undefined

Works with 1.12.0 so we stick to that version for now.

All 8 comments

We have a similar problem with version 1.13.0:

Module build failed (from ./node_modules/cypress-cucumber-preprocessor/loader.js):
TypeError: Cannot read property 'replace' of undefined

Works with 1.12.0 so we stick to that version for now.

@waxisien thanks for the information, I'll try it tomorrow :)

any update on this? I'm working on something based on your repo. I keep getting:
Module build failed (from ./node_modules/cypress-cucumber-preprocessor/loader.js):
TypeError: Path must be a string. Received undefined

There is a fix for this on master but it is not in a released version yet.
Maybe update your dependencies to point at the master branch of the github repo until this gets released

  "devDependencies": {
    "@cypress/webpack-preprocessor": "^4.0.2",
    "cypress": "^3.4.1",
    "cypress-cucumber-preprocessor": "github:TheBrainFamily/cypress-cucumber-preprocessor#master",
    "ts-loader": "^5.3.1",
    "typescript": "^3.2.1",
    "webpack": "^4.28.2"
  }

Note, however, that at the moment you will also need to update your webpack.config.js with a bunch of empty mock modules to get the cucumber-cypress-preprocessor to run tests loaded through webpack again.

module.exports = {
  resolve: {
    extensions: [".ts", ".js"]
  },
  node: { fs: "empty", child_process: "empty", readline: "empty" }, <-- this needs adding
  module: {
    rules: [
      {
        test: /\.ts$/,
        exclude: [/node_modules/],
        use: [
          {
            loader: "ts-loader"
          }
        ]
      },
      {
        test: /\.feature$/,
        use: [
          {
            loader: "cypress-cucumber-preprocessor/loader"
          }
        ]
      }
    ]
  }
};

Any eta on that release?

sorry everyone, this repo is setup for automatic releases and that merged PR from @jcundill somehow slipped through the automation (I forgot to put ":" after fix keyword) and didn't release.. I've done a manual release, so it's now released as 1.31.1

I also updated the example. I'm thinking that we should run all the example repos on CI with every new version, to prevent mess-ups like this one.

I think this should be working now, in the future we might possibly not need the extra node section ( #197 ), but for now that should work. If you still have problems please comment here and tag me, or create a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leegee picture leegee  路  4Comments

praveen1000 picture praveen1000  路  3Comments

PrinceJohn picture PrinceJohn  路  3Comments

badeball picture badeball  路  5Comments

DanielStoica85 picture DanielStoica85  路  4Comments