Skip to content

Commit 3651f88

Browse files
authored
fix: verify dogT exists in the context before using it (#692)
getTestingT(ctx) can return a nil pointer (if there is no dogT in the context) in this case a segfault causes the whole test harness to fail. By verifying whether there is a dogT in the context, the test can continue.
1 parent 532be7d commit 3651f88

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

suite.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ func (s *suite) runStep(ctx context.Context, pickle *Scenario, step *Step, scena
159159

160160
// Check for any calls to Fail on dogT
161161
if err == nil {
162-
err = getTestingT(ctx).isFailed()
162+
if t := getTestingT(ctx); t != nil {
163+
err = t.isFailed()
164+
}
163165
}
164166

165167
status := StepUndefined

0 commit comments

Comments
 (0)