Skip to content

Commit 7d984ef

Browse files
vearutopnhatthm
andauthored
Run before step hooks before matching (#425)
* Run before step hooks before matching * Add note to CHANGELOG.md Co-authored-by: nhatthm <[email protected]>
1 parent afaebf2 commit 7d984ef

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
88

99
---
1010

11+
## [Unreleased]
12+
13+
### Fixed
14+
15+
- Unintended change of behavior in before step hook ([424](https://github.com/cucumber/godog/pull/424) - [nhatthm])
16+
1117
## [v0.12.0]
1218

1319
### Added
@@ -190,7 +196,8 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
190196

191197
<!-- Releases -->
192198

193-
[unreleased]: https://github.com/cucumber/godog/compare/v0.11.0...main
199+
[unreleased]: https://github.com/cucumber/godog/compare/v0.12.0...main
200+
[v0.12.0]: https://github.com/cucumber/godog/compare/v0.11.0...v0.12.0
194201
[v0.11.0]: https://github.com/cucumber/godog/compare/v0.10.0...v0.11.0
195202
[v0.10.0]: https://github.com/cucumber/godog/compare/v0.9.0...v0.10.0
196203
[0.9.0]: https://github.com/cucumber/godog/compare/v0.8.1...v0.9.0
@@ -215,3 +222,4 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
215222
[chirino]: https://github.com/chirino
216223
[radtriste]: https://github.com/radtriste
217224
[karfrank]: https://github.com/karfrank
225+
[nhatthm]: https://github.com/nhatthm

suite.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ func (s *suite) runStep(ctx context.Context, pickle *Scenario, step *Step, prevS
134134
ctx, err = s.runBeforeScenarioHooks(ctx, pickle)
135135
}
136136

137+
// run before step handlers
138+
ctx, err = s.runBeforeStepHooks(ctx, step, err)
139+
137140
match = s.matchStep(step)
138141
s.storage.MustInsertStepDefintionMatch(step.AstNodeIds[0], match)
139142
s.fmt.Defined(pickle, step, match.GetInternalStepDefinition())
140143

141-
// run before step handlers
142-
ctx, err = s.runBeforeStepHooks(ctx, step, err)
143-
144144
if err != nil {
145145
sr = models.NewStepResult(pickle.Id, step.Id, match)
146146
sr.Status = models.Failed

0 commit comments

Comments
 (0)