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

Global steps #67

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Conversation

AaronBuxbaum
Copy link

Implements a function which allows the user to define global steps.

The system searches for a global match if there is no step defined (ie. when('I click the button') as opposed to when('I click the button', () => {...})). When this happens, we search through the available global steps; if no match exists, it will throw an error.

In addition, code generation should search through the global steps and automatically remove the function callback where there is an existing global step with the same name.

Lastly, I added an opt-in option to disable code generation from giving you regexes -- this is because the regex match for globals is quite precarious (it needs to be a === string match), and because with global steps, you may actually want all of your steps to be strings and to throw on any change. You probably won't need it for most cases, but it's good to have.

Thanks to @pedrowilkens for the idea -- this is effectively his code with a few adjustments:
#52 (comment)

@Philyorkshire
Copy link

Is there an ETA on this being merged? I am really keen to use this functionality.

@ian7
Copy link

ian7 commented Jan 30, 2020

I've made background steps work here: https://github.com/ian7/jest-cucumber/tree/background

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

Successfully merging this pull request may close these issues.

3 participants