Skip to content

New cypress-cucumber-preprocessor 1.19.0 + cypress/webpack-preprocessor = error when executing tests #291

@Lukaszli

Description

@Lukaszli

cypress-io/cypress#5998

New cypress-cucumber-preprocessor - version 1.19.0
(https://github.com/TheBrainFamily/cypress-cucumber-preprocessor) and cypress/webpack-preprocessor is causing an error when trying to execute tests.

Everything is working when using Cypress 3.7.0 and cypress-cucumber-preprocessor 1.18.0.
I have the same error when I am using Cypress 3.7.0 and cypress-cucumber-preprocessor 1.19.0.
But it looks like I get it working when using Cypress 3.8.0 and cypress-cucumber-preprocessor 1.18.0 so it looks like it is an issue in cypress-cucumber-preprocessor 1.19.0 :)

Error:
(I had to remove some data from paths so the error is edited a little bit)

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

  cypress\features\XXXX.feature

The error was:

./cypress/features/XXXX.feature
eposXXXe2e_testsrror: Can't resolve 'C:Users
ode_modulescypress-cucumber-preprocessorlib/createTestsFromFeature' in 'C:\Users\XXXX\repos\XXX\e2e_tests\cypress\features'
eposXXXe2e_testszli
ode_modulescypress-cucumber-preprocessorlib/createTestsFromFeature' in 'C:\Users\XXXX\repos\XXX\e2e_tests\cypress\features'
  Parsed request is a module
  using description file: C:\Users\XXXX\repos\XXX\e2e_tests\package.json (relative path: ./cypress/features)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      C:\Users\XXXX\repos\XXX\e2e_tests\cypress\features\node_modules doesn't exist or is not a directory
      C:\Users\XXXX\repos\XXX\e2e_tests\cypress\node_modules doesn't exist or is not a directory
      C:\Users\XXXX\repos\XXX\node_modules doesn't exist or is not a directory
      C:\Users\XXXX\repos\node_modules doesn't exist or is not a directory
      C:\Users\XXXX\node_modules doesn't exist or is not a directory
      C:\Users\node_modules doesn't exist or is not a directory
      C:\node_modules doesn't exist or is not a directory
      looking for modules in C:\Users\XXXX\repos\XXX\e2e_tests\node_modules
        using description file: C:\Users\XXXX\repos\XXX\e2e_tests\package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
eposXXXe2e_testscription file: C:\Users\XXXX\repos\XXX\e2e_tests\package.json (relative path: ./node_modules/C:Users
ode_modulescypress-cucumber-preprocessorlib/createTestsFromFeature)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
eposXXXe2e_testsers\XXXX\repos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\createTestsFromFeature doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
eposXXXe2e_testsers\XXXX\repos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\createTestsFromFeature.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
eposXXXe2e_testsers\XXXX\repos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\createTestsFromFeature.js doesn't exist
            as directory
eposXXXe2e_testsers\XXXX\repos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\createTestsFromFeature doesn't exist
[C:\Users\XXXX\repos\XXX\e2e_tests\cypress\features\node_modules]
[C:\Users\XXXX\repos\XXX\e2e_tests\cypress\node_modules]
[C:\Users\XXXX\repos\XXX\node_modules]
[C:\Users\XXXX\repos\node_modules]
[C:\Users\XXXX\node_modules]
[C:\Users\node_modules]
[C:\node_modules]
eposXXXe2e_testspos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\createTestsFromFeature]
eposXXXe2e_testspos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\createTestsFromFeature.ts]
eposXXXe2e_testspos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\createTestsFromFeature.js]
 @ ./cypress/features/XXXX.feature 24:4-123
 @ multi ./cypress/features/XXXX.feature

./cypress/features/XXXX.feature
eposXXXe2e_testsrror: Can't resolve 'C:Users
ode_modulescypress-cucumber-preprocessorlib/resolveStepDefinition' in 'C:\Users\XXXX\repos\XXX\e2e_tests\cypress\features'
eposXXXe2e_testszli
ode_modulescypress-cucumber-preprocessorlib/resolveStepDefinition' in 'C:\Users\XXXX\repos\XXX\e2e_tests\cypress\features'
  Parsed request is a module
  using description file: C:\Users\XXXX\repos\XXX\e2e_tests\package.json (relative path: ./cypress/features)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      C:\Users\XXXX\repos\XXX\e2e_tests\cypress\features\node_modules doesn't exist or is not a directory
      C:\Users\XXXX\repos\XXX\e2e_tests\cypress\node_modules doesn't exist or is not a directory
      C:\Users\XXXX\repos\XXX\node_modules doesn't exist or is not a directory
      C:\Users\XXXX\repos\node_modules doesn't exist or is not a directory
      C:\Users\XXXX\node_modules doesn't exist or is not a directory
      C:\Users\node_modules doesn't exist or is not a directory
      C:\node_modules doesn't exist or is not a directory
      looking for modules in C:\Users\XXXX\repos\XXX\e2e_tests\node_modules
        using description file: C:\Users\XXXX\repos\XXX\e2e_tests\package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
eposXXXe2e_testscription file: C:\Users\XXXX\repos\XXX\e2e_tests\package.json (relative path: ./node_modules/C:Users
ode_modulescypress-cucumber-preprocessorlib/resolveStepDefinition)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
eposXXXe2e_testsers\XXXX\repos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\resolveStepDefinition doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
eposXXXe2e_testsers\XXXX\repos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\resolveStepDefinition.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configurationR
eposXXXe2e_testsers\XXXX\repos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\resolveStepDefinition.js doesn't exist
            as directory
eposXXXe2e_testsers\XXXX\repos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\resolveStepDefinition doesn't exist
[C:\Users\XXXX\repos\XXX\e2e_tests\cypress\features\node_modules]
[C:\Users\XXXX\repos\XXX\e2e_tests\cypress\node_modules]
[C:\Users\XXXX\repos\XXX\node_modules]
[C:\Users\XXXX\repos\node_modules]
[C:\Users\XXXX\node_modules]
[C:\Users\node_modules]
[C:\node_modules]
eposXXXe2e_testspos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\resolveStepDefinition]
eposXXXe2e_testspos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\resolveStepDefinition.ts]
eposXXXe2e_testspos\XXX\e2e_tests\node_modules\C:Users
ode_modulescypress-cucumber-preprocessorlib\resolveStepDefinition.js]
 @ ./cypress/features/XXXX.feature 14:4-122
 @ multi ./cypress/features/XXXX.feature

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.

Versions

Tested on Windows 10.
Cypress 3.7.0
Cypress 3.8.0

  "dependencies": {
    "cypress": "^3.8.0",
    "cypress-cucumber-preprocessor": "^1.18.0",
    "ts-loader": "^6.2.1",
    "typescript": "^3.7.3",
    "webpack": "^4.41.2",
  },
  "devDependencies": {
    "@cypress/webpack-preprocessor": "^4.1.1",
    "@types/cypress-cucumber-preprocessor": "^1.14.0",
  },

In /cypress/plugins/index.js I have:
const cucumber = require('cypress-cucumber-preprocessor').default;

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

In /cypress/support/index.js I don't have anything related to cypress-cucumber-preprocessor

My feature files are written in Gherkin and my step_definitions are using:
import { Given } from 'cypress-cucumber-preprocessor/steps';

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions