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 3.8.0 + cypress-cucumber-preprocessor + cypress/webpack-preprocessor = error when executing tests #5998

Closed
Lukaszli opened this issue Dec 18, 2019 · 4 comments

Comments

@Lukaszli
Copy link

Lukaszli commented Dec 18, 2019

New Cypress 3.8.0 with 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 also tried using new cypress-cucumber-preprocessor 1.19.0 which returned the same result.

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.

  "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",
  },
@Lukaszli Lukaszli changed the title New Cypress 3.8.0 + cypress-cucumber-preprocessor + cypress/webpack-preprocessor --can't execute tests New Cypress 3.8.0 + cypress-cucumber-preprocessor + cypress/webpack-preprocessor = error when executing tests Dec 18, 2019
@jennifer-shehane
Copy link
Member

This error is referencing this function from cypress-cucumber-preprocessor. https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/ff1f41ff53036356ee682253b88cdccdb77b0bd5/lib/createTestsFromFeature.js#L5

Can you provide your setup? plugins/index.js, support/index.js, etc? Also how you are requiring the module in your test/feature file?

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Dec 20, 2019
@Lukaszli
Copy link
Author

Lukaszli commented Dec 20, 2019

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

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 :)

Sorry for bothering you, I will create an issue on cypress-cucumber-preprocessor github.

@lgandecki
Copy link

yeah this is a known regression, the newest version - released 3 days ago, apparently doesn't work with windows - we've had a few tickets about this already. I'd recommend to use 1.18.0 for now - the change in 1.19.0 is not something you'd need, if you didn't need it so far. I don't have windows handy to debug this properly, I think I will just revert that change for now. this issue can be closed here.

@jennifer-shehane jennifer-shehane added stage: awaiting external fix A 3rd party bug in Cypress - awaiting release and removed stage: needs information Not enough info to reproduce the issue labels Dec 23, 2019
@jennifer-shehane
Copy link
Member

Closing as an issue in cypress-cucumber-preprocessor 1.19.0. Follow this issue for progress. badeball/cypress-cucumber-preprocessor#291

@jennifer-shehane jennifer-shehane removed the stage: awaiting external fix A 3rd party bug in Cypress - awaiting release label Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants