-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Duplicated stepdefs do not throwing any error?! #176
Comments
True Cucumber always picks the reg exp found in first step definition. you have to be careful with the reg exp defined in feature file and the step definition. Am not sure if we have any alternate solution for this, but I usually suggest my team to be careful with this. |
@sajesh2686 I don't think that is something we can compromise with, team members can never be that careful enough. |
TL;DR: cucumber.js should throw an exception. It is an issue in cucumber.js. Cucumber-ruby throws an error when two matches are found for a step. It also provides a |
This now seems to have missed its planned release milestone. I'm still getting problems with this in 0.5.1. |
@dmeehan1968 would you be interested in sending a pull request to fix this? |
Yes, happy to create a PR, but a bit short on time. I had a bit of a look through the code to find the point where step defs are matched but couldn't find the relevant point. If you can point me to the relevant routine/module that would be very helpful. |
@dmeehan1968 thanks! Have a look here:
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I made two step definitions with completely the same regex in 2 different javascript files under the step_definitions folder as following:
a.js
b.js
When I ran the test, I figured out that cucumber-js load the 2 files in alphabetical order, so the working definition was actually in 'b.js'.
I thought it would be unsafe not throwing any error(such as 'Duplicated step definitions') because when we deal with large amount of stepdefs, we cannot guarantee we will not accidentally override previous stepdefs and that would certainly cause lots of troubles.
Did I do it wrong or it is actually an issue with the cucumber-js?
The text was updated successfully, but these errors were encountered: