I want to change the name of common folder to steps folder;
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"commonPath" : "cypress/integration/steps",
}
It doesn't work
Please make a small reproduction and push to github
ok.. let me update
@lgandecki
const commonPath =
loaded.config.commonPath || ${stepDefinitionPath()}/common/;
based on above current logic commonPath is directly referring to "loaded.config.commonPath" if commonPath is configured in package.json.
In this repo (https://github.com/TheBrainFamily/cypress-cucumber-example), i have added configured commonPath as "cypress/integration/common", then see below error. Here commonPath is trying load from step definitions path instead of working directory path
Error: Cannot find module 'cypress/integration/common/globalBefore.js' from '/Users/sgorla/myworkspace/cypress-cucumber-example/cypress/integration/socialNetworks'
If I get commonPath inside of working directory as mentioned below, working fine.
const appRoot = process.cwd();
const commonPath =
${appRoot}/${loaded.config.commonPath} || ${stepDefinitionPath()}/common/;
I have the same issue, working on the example project https://github.com/TheBrainFamily/cypress-cucumber-example.
I have modified the name of the common steps folder to 'common-steps' and the configuration of cypress-cucumber-preprocessor in the package.json like this:
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"commonPath": "cypress/integration/common-steps"
}
When I execute the test, this is the error I get:
Error: Cannot find module 'cypress/integration/common-steps/I_see_STRING_in_the_title.js' from 'C:\Users\user\workspace\cypress-cucumber-example\cypress\integration\socialNetworks'
If I let the default folder name and the default value on that property, it works, but changing the name of the common steps folder and modifying the property results on that error.
I am getting the same issue and can reproduce with the same steps as @sagorla and @amadridlar. Would be great to be able to use this config setting.
I believe the issue is the appRoot is not prepended to the commonPath value.
e.g.
The following does not work. Results in the error mentioned by other users.
```
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"commonPath": "cypress/integration/bacon-steps"
}
This however will work
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"commonPath": "/Users/iambacon/web-tests/cypress/integration/bacon-steps"
}
```
Same issue here. Relative path didn't work but the whole path worked for the stepDefinitions.
My case not working :
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": false,
"stepDefinitions": "./e2e/src/integration"
}
My case working :
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": false,
"stepDefinitions": "D:/projects/myproject/e2e/src/integration"
}
I think you don't manage relative path.
Anyone is going to fix that issue? It is impossible to use this plugin with non-default folder structure (especially when you use monorepo like Nx).
https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/pull/236
should handle this issue.
Is this still an issue? or as @LPCmedia suggests, we can close this one?
@lgandecki This is the same issue as #236 so I think it can be closed
Thanks! Please create a new one if something is still not right.
Most helpful comment
Anyone is going to fix that issue? It is impossible to use this plugin with non-default folder structure (especially when you use monorepo like Nx).