-
-
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
hooks: Add BeforeStep and AfterStep Hooks #1416
hooks: Add BeforeStep and AfterStep Hooks #1416
Conversation
@charlierudolph Could you take a look at this PR when you get the chance? @davidjgoss Is there a possibility of getting this into the 7.0.0 release? |
@aslakhellesoy can you review this or find some one to review it? |
I’ll try to get it done this week |
I should be able to review tonight - sorry for delay |
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.
As you mentioned we should add appropriate unit test coverage for pickle_runner
and support_code_library_builder
.
Also a recent addition is that we emit messages for support code definitions that can be picked up by formatters - could you follow this pattern for these new hooks? See https://github.com/cucumber/cucumber-js/blob/master/src/cli/helpers.ts#L246
@davidjgoss I've finished addressing all your code review comments and adding unit tests where appropriate. Please let me know of any other changes/updates I still need to make to this pull request. |
…/cucumber-js into addBeforeAfterStepHooks
@charlierudolph Apologies for the bad commit history, accidentally did a merge instead of rebase with master. Got everything working again with your changes, and did the changes you requested. Now there's just 1 runStepHooks function, and removed isSkippingStep(), and returns the array For the runStep function, I still have it not run the step itself if any of the beforeStep hooks fail, as this is in-line with how the Before Scenario hooks won't run a scenario if they fail, unless we want them to be different? (or my use of Before Scenario hooks in my projects just makes me think this is how they work. I can easily change this if we want.) Otherwise I refactored the function with this workflow: I feel like this is good? |
@charlierudolph @davidjgoss Any other comments / review for this PR? Or are we good to finally merge this? |
I agree with not running the step if a beforeStepHook fails but we should always run afterStepHooks. |
@charlierudolph Updated the variable names, and made the change so that the only thing that won't happen if the beforeStep Hooks fail, is that the step itself won't run, but afterStep Hooks / sum duration will. |
Hi @Adam-ARK, Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾 In return for this generous offer we hope you will:
On behalf of the Cucumber core team, |
Another PR attempt to get BeforeStep/AfterStep hooks (#1058) promoted into the project (hopefully for the 7.0.0 release), since the current open PR(#997) hasn't been touched since May. This PR used PR #997 as the base, fixing all existing issues to get all unit/feature tests passing, and fixed merge conflicts with latest code. Then used the feature files from PR #1058 to add tests for functionality.
Also updated files under /docs/ to describe the new hook usage.
Not sure what all is still required before this attempted solution can be merged, besides possibly more unit tests?