From d1d5a6ba17ed377c14fbdbf9e40a48580b56b90b Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 9 Aug 2022 13:31:18 +0200 Subject: [PATCH 1/2] Skip undefined steps in after scenario hooks --- suite.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/suite.go b/suite.go index 261ed289..05860526 100644 --- a/suite.go +++ b/suite.go @@ -99,7 +99,7 @@ func (s *suite) runStep(ctx context.Context, pickle *Scenario, step *Step, prevS rctx, err = s.runAfterStepHooks(ctx, step, sr.Status, err) // Trigger after scenario on failing or last step to attach possible hook error to step. - if sr.Status != StepSkipped && ((err == nil && isLast) || err != nil) { + if isLast || (sr.Status != StepSkipped && sr.Status != StepUndefined && err != nil) { rctx, err = s.runAfterScenarioHooks(rctx, pickle, err) } From e158c25b3b51f7428055e2e68f2201c535dd20da Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 9 Aug 2022 13:36:59 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fd8100e..a48c3c83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt ### Fixed - Fixed a bug which would ignore the context returned from a substep.([488](https://github.com/cucumber/godog/pull/488) - [wichert](https://github.com/wichert)) - Fixed a bug which would cause a panic when using the pretty formatter with a feature that contained a rule. ([480](https://github.com/cucumber/godog/pull/480) - [dumpsterfireproject](https://github.com/dumpsterfireproject)) +- Multiple invocations of AfterScenario hooks in case of undefined steps. ([494](https://github.com/cucumber/godog/pull/494) - [vearutop](https://github.com/vearutop)) ### Deprecated - `godog` CLI tool prints deprecation warning. ([489](https://github.com/cucumber/godog/pull/489) - [vearutop](https://github.com/vearutop))