Skip to content

Commit

Permalink
Do not discard context from substeps
Browse files Browse the repository at this point in the history
fixes #487
  • Loading branch information
wichert committed Jul 22, 2022
1 parent 5e176da commit a4846a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,7 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
- README example is updated with `context.Context` and `go test` usage. ([477](https://github.com/cucumber/godog/pull/477) - [vearutop](https://github.com/vearutop))

### Fixed
- Fixed a bug which would ignore the context returned from a substep.([488](https://github.com/cucumber/godog/pull/480) - [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))

## [v0.12.5]
Expand Down
4 changes: 3 additions & 1 deletion suite.go
Expand Up @@ -346,10 +346,12 @@ func (s *suite) maybeSubSteps(ctx context.Context, result interface{}) (context.
return ctx, fmt.Errorf("unexpected error, should have been []string: %T - %+v", result, result)
}

var err error

for _, text := range steps {
if def := s.matchStepText(text); def == nil {
return ctx, ErrUndefined
} else if ctx, err := s.maybeSubSteps(def.Run(ctx)); err != nil {
} else if ctx, err = s.maybeSubSteps(def.Run(ctx)); err != nil {
return ctx, fmt.Errorf("%s: %+v", text, err)
}
}
Expand Down

0 comments on commit a4846a7

Please sign in to comment.