-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Step definitions inside subfolders don't work when providing commonPath to the config #594
Comments
Hi, you're not alone. I'm experiencing the same thing as well. Took me 3 days to figure out it was the dependency and not user error. |
Sorry for this, you are absolutely right, and what's even worse, we have a test for this specific combinations of options and we mocked the path.resolve in a wrong way: jest.mock("path", () => ({
resolve(appRoot, commonPath) {
return `./${appRoot}/${commonPath}`;
},
extname() {
return ".js";
},
})); which would keep the trailing slash passed from commonPath, when in reality resolve removes it. We don't even need that mock, so I removed it and fixed the issue, the release should be out there soon. |
🎉 This issue has been resolved in version 4.1.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Current behavior
When setting a custom commonPath via the config, the files in subfolders won't work. To reproduce:
cypress/step_definitions/subfolder/step_def.js
Issue: I won't be able to find the step definition
Note: If you put it under
cypress/step_definitions/step_def.js
, it will work.Desired behavior
It should find the step definition even if it's inside a subfolder.
Test code to reproduce
package.json
cypress/step_definitions/subfolder/step_def.js
cypress/integration/test.feature
Possible issue
It seems under
cypress-cucumber-preprocessor/lib/getStepDefinitionsPaths.js
for the getStepDefinitionsPaths function, it has:The
path.resolve()
will always remove the trailing slash, so even when my commonPath includes trailing slash ("cypress/step_definitions/"), thecommonDefinitionsPattern
will always be "cypress/step_definitions**/*.+(js|ts|tsx)"Versions
The text was updated successfully, but these errors were encountered: