-
-
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
Upgrade to Cucumber Expressions 3.0.0 #764
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
The build is failing because of ES features (class
) used by cucumber-expressions that are not available on Node 4.
Should we just add cucumber-expressions to the files transpiled by babel?
.gitignore
Outdated
@@ -3,3 +3,4 @@ | |||
lib/ | |||
node_modules | |||
usage.txt | |||
.idea/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if we avoided IDE-specific exclusions.
It's often recommended to do that locally so that we don't have to worry about everyone's preferred IDEs/editors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add it to the repo, then we don't have to worry about some git noob adding their whole IDE config folder in a PR.
Is this really worth worrying about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a "git noob" sends a PR with the whole .idea
folder checked in, it would be a great opportunity to teach them a bit more about Git 👍
But no, it's probably not worth discussing any further. I told you my preference, you decide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm with @jbpros here. I believe anything that is not universal to this project belongs in your local global gitignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just my two cents: We don't have to "worry" about everyone's preferred IDE, if we just accept their addition to the gitignore whenever it comes. Also, I'm guessing this won't be the last time someone tries to add .idea/
to the gitignore.
But I agree, either way this isn't worth worrying about lol
src/support_code_library/builder.js
Outdated
console.error('addTransform is obsolete and will be removed in a future version. Please use addParameter instead.') | ||
} | ||
addParameter({captureGroupRegexps, transformer, typeName}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer not to have function definitions in here. Can these be moved into helpers? Similar to how After/Before/defineStep work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 47d54ec
src/support_code_library/builder.js
Outdated
// eslint-disable-next-line no-console | ||
if (console !== 'undefined' && typeof console.error === 'function') { | ||
// eslint-disable-next-line no-console | ||
console.error('addTransform is obsolete and will be removed in a future version. Please use addParameter instead.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use util.deprecate here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice, wasn't aware of that one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in d4d4728
}) | ||
""" | ||
When I run cucumber.js | ||
Then the step "a passing step" has status "passed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a newline to the end of this file. Thanks for writing this feature test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in d7642f0
The |
@aslakhellesoy I'm uncertain about changing the API to |
The Custom parameter types can be registered, and they have a name, pattern (or list of patterns) and a transform function. For convenience there are a couple of "built-in" transforms for It's important to establish a ubiquitous language for the various Cucumber implementations, both for the API and the documentation. Ideally Cucumber would provide an API that is identical to the "internal" Cucumber Expressions API. I did design the external API of Cucumber Expressions to be "user friendly". I think parameter and parameter type are better names than transform for a few reasons. The term parameter is a familiar concept in programming. It allows us to say things like: "The A parameter doesn't necessarily have to transform a string - it could leave it unchanged. A custom parameter is still useful in many cases, typically when we want to restrict matching to a particular pattern, such as Maybe it would be better to rename Regarding the Cucumber API - I think it would be better to use positional arguments (as described in the docs) rather than named ones. The |
What are your thoughts on this @charlierudolph ? |
I like the rename to |
Ok, sounds good. I hope to release a new Cucumber Expressions in a couple of days with those renames, and a few other goodies. I'll update this PR after that, and then we should be good to go! (Plus the two other PRs I've submitted that depend on this one). |
2df2293
to
72c3d4a
Compare
I've done the renames, can you take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Thanks @aslakhellesoy
src/support_code_library/builder.js
Outdated
import * as helpers from './helpers' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add this newline back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seriously?
.gitignore
Outdated
@@ -3,3 +3,4 @@ | |||
lib/ | |||
node_modules | |||
usage.txt | |||
.idea/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please remove this? I strongly agree with @jbpros and would prefer to take that opportunity to teach people to use their local global gitignore.
@@ -0,0 +1,69 @@ | |||
Feature: Custom Parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use parameter type
instead of parameter
in this title, the feature description, and the scenario titles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually looks like this was done in one of the following PRs so this can be ignored.
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. |
This PR upgrades to Cucumber Expressions 3.0.0, which has several improvements.
This PR also removes the custom logic to compute parameter names in snippet functions, and uses the logic provided by the cucumber-expressions library instead.