From a4846a7fe31a312416fe849f7b137d907e33b325 Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Fri, 22 Jul 2022 14:04:54 +0200 Subject: [PATCH] Do not discard context from substeps fixes #487 --- CHANGELOG.md | 1 + suite.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cd2f029..f6ca225a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/suite.go b/suite.go index ebb97c5d..261ed289 100644 --- a/suite.go +++ b/suite.go @@ -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) } }