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

Improve hooks invocation flow #568

Merged
merged 2 commits into from Jul 13, 2023
Merged

Improve hooks invocation flow #568

merged 2 commits into from Jul 13, 2023

Conversation

vearutop
Copy link
Member

@vearutop vearutop commented Jul 12, 2023

🤔 What's changed?

  • Added a test for hooks/steps sequence and final result.
  • Added ErrSkip to skip scenario from a step.
  • Fixed issue when AfterScenario could be invoked twice.
  • Added step hooks invocation for multi steps.

⚡️ What's your motivation?

Hooks invocation isn't consistent across different situations, this PR tries to improve that and make behavior less surprising.
Resolves #565.
Resolves #560.
Resolves #486.

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)
  • ⚡ New feature (non-breaking change which adds new behaviour)

♻️ Anything particular you want feedback on?

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@github-actions
Copy link

Go API Changes

# github.com/cucumber/godog
## compatible changes
ErrSkip: added
ScenarioContext.AfterScenario: added
ScenarioContext.AfterStep: added
ScenarioContext.BeforeScenario: added
ScenarioContext.BeforeStep: added
ScenarioContext.Given: added
ScenarioContext.Step: added
ScenarioContext.StepContext: added
ScenarioContext.Then: added
ScenarioContext.When: added

# github.com/cucumber/godog/formatters
## compatible changes
Given: added
Keyword: added
None: added
StepDefinition.Keyword: added
Then: added
When: added

# summary
Inferred base version: v0.12.6
Suggested version: v0.13.0

@codecov
Copy link

codecov bot commented Jul 12, 2023

Codecov Report

Merging #568 (832cf53) into main (51d164f) will decrease coverage by 0.03%.
The diff coverage is 77.61%.

@@            Coverage Diff             @@
##             main     #568      +/-   ##
==========================================
- Coverage   82.96%   82.94%   -0.03%     
==========================================
  Files          28       28              
  Lines        3375     3412      +37     
==========================================
+ Hits         2800     2830      +30     
- Misses        461      467       +6     
- Partials      114      115       +1     
Impacted Files Coverage Δ
suite.go 86.92% <77.61%> (-2.48%) ⬇️

... and 1 file with indirect coverage changes

@vearutop vearutop marked this pull request as ready for review July 12, 2023 23:06
@vearutop vearutop merged commit 3e0f902 into main Jul 13, 2023
6 of 7 checks passed
@vearutop vearutop deleted the refactor_hooks branch July 13, 2023 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant