Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Lukaszli opened this issue Dec 20, 2019 · 8 comments
Labels

Comments

@Lukaszli
Copy link

Lukaszli commented Dec 20, 2019

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';

@mptrs
Copy link

mptrs commented Dec 23, 2019

Looks like the issue is already in 1.17.0. Might be a change in the settings?

@lgandecki
Copy link
Collaborator

Looks like or you are sure? Please Go to your node_modules/ find the package and check what version you have installed in the Cypress cucumber preprocessor package.json

@mptrs
Copy link

mptrs commented Dec 23, 2019

Tried all version above 1.16.2 and get the same error.

@mlsad3
Copy link

mlsad3 commented Dec 27, 2019

Not sure if this is the same thing, but I am hitting an issue when upgrading Cypress to 3.8. Note, it did something weird to my path in the error message (and removed my slashes in the paths):

Error: Cannot find module 'C:Developmentmytestenvironment estingcypress
ode_modulescypress-cucumber-preprocessorlib/resolveStepDefinition' from 'c:\Development\mytestenvironment\testing\cypress\cypress\integration\procedure\mytest'
  at c:\Development\mytestenvironment\testing\cypress\node_modules\browser-resolve\node_modules\resolve\lib\async.js

It looks like the same thing though. Notice my lines have the same butchered white-space as @Lukaszli

I am running 1.19.0 (when I look in the node_modules/cypress-cucumber-preprocessor/package.json

@mlsad3
Copy link

mlsad3 commented Dec 27, 2019

@Jscaramal found it was due to commit 152ccdd (Oct 11). After I reverted, it is now running as expected in Windows for me

@Lukaszli
Copy link
Author

For my case I have the latest Cypress 3.8.1 and cypress-cucumber-preprocessor in version 1.19.0 is causing an error while 1.18.0 is working fine :)

lgandecki added a commit that referenced this issue Jan 13, 2020
@lgandecki
Copy link
Collaborator

🎉 This issue has been resolved in version 1.19.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lgandecki
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants