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.

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

See original GitHub issue

https://github.com/cypress-io/cypress/issues/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';

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
lgandeckicommented, Jan 22, 2020

For people coming from Google - if you still seem to have this problem please try the 2.0.1 Or more recent version

0reactions
lgandeckicommented, Jan 13, 2020

🎉 This issue has been resolved in version 1.19.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

New cypress-cucumber-preprocessor 1.19.0 + ... - GitHub
New cypress-cucumber-preprocessor 1.19.0 + cypress/webpack-preprocessor = error when executing tests #291. Lukaszli opened this issue on Dec 20, ...
Read more >
cypress-cucumber-preprocessor does not parse feature files
I have followed the installation steps as mentioned in this link but while running the tests I am getting the below error. It...
Read more >
cypress-cucumber-preprocessor - npm
Run cucumber/gherkin-syntaxed specs with Cypress.io. The cypress-cucumber-preprocessor adds support for using feature files when testing ...
Read more >
Testing using Cypress and Cucumber in JavaScript
A new Test Execution will be created (unless you originally exported the Scenarios/Scenario Outlines from a Test Execution). One of the tests ......
Read more >
How to use Cypress with Cucumber BDD (Cypress 10 Upgrade)
In this article, we will discuss in detail how to add cucumber (A BDD framework) in cypress and write tests in Gherkin format....
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