From c530fb3cc2c0e1e50456f9c16f9ebdd5982201cf Mon Sep 17 00:00:00 2001 From: Onsi Fakhouri Date: Mon, 23 Jan 2023 16:07:07 -0700 Subject: [PATCH] improve eventually failure message output --- internal/async_assertion.go | 2 +- internal/async_assertion_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/async_assertion.go b/internal/async_assertion.go index 251b6b14d..7f6226968 100644 --- a/internal/async_assertion.go +++ b/internal/async_assertion.go @@ -446,7 +446,7 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch message += renderError(fmt.Sprintf("The function passed to %s returned the following error:", assertion.asyncType), actualErr) } if hasLastValidActual { - message += fmt.Sprintf("\nAt one point, however, the function did return successfully. But %s failed because", assertion.asyncType) + message += fmt.Sprintf("\nAt one point, however, the function did return successfully.\nYet, %s failed because", assertion.asyncType) _, e := matcher.Match(lastValidActual) if e != nil { message += renderError(" the matcher returned the following error:", e) diff --git a/internal/async_assertion_test.go b/internal/async_assertion_test.go index b12720fec..aa238bf88 100644 --- a/internal/async_assertion_test.go +++ b/internal/async_assertion_test.go @@ -756,7 +756,7 @@ var _ = Describe("Asynchronous Assertions", func() { }).WithTimeout(100 * time.Millisecond).WithPolling(10 * time.Millisecond).Should(Equal(10)) Ω(ig.FailureMessage).Should(ContainSubstring("The function passed to Eventually failed at %s:%d with:\nExpected\n : ", file, line+3)) Ω(ig.FailureMessage).Should(ContainSubstring("to be <\n : 3")) - Ω(ig.FailureMessage).Should(ContainSubstring("At one point, however, the function did return successfully. But Eventually failed because the matcher was not satisfied:\nExpected\n : 2\nto equal\n : 10")) + Ω(ig.FailureMessage).Should(ContainSubstring("At one point, however, the function did return successfully.\nYet, Eventually failed because the matcher was not satisfied:\nExpected\n : 2\nto equal\n : 10")) }) }) @@ -1445,7 +1445,7 @@ sprocket: Ω(ig.FailureMessage).Should(ContainSubstring("Timed out after")) Ω(ig.FailureMessage).Should(ContainSubstring("told to try again after 10s: bam")) - Ω(ig.FailureMessage).Should(ContainSubstring("At one point, however, the function did return successfully. But Eventually failed because the matcher was not satisfied:\nExpected\n : 2\nto equal\n : 4")) + Ω(ig.FailureMessage).Should(ContainSubstring("At one point, however, the function did return successfully.\nYet, Eventually failed because the matcher was not satisfied:\nExpected\n : 2\nto equal\n : 4")) }) }) @@ -1592,7 +1592,7 @@ sprocket: return false, nil }), "My Description") Ω(ig.FailureMessage).Should(ContainSubstring("My Description\nThe function passed to Eventually returned the following error:\nactual-err\n <*errors.errorString")) - Ω(ig.FailureMessage).Should(ContainSubstring("At one point, however, the function did return successfully. But Eventually failed because the matcher returned the following error:\nmatcher-err")) + Ω(ig.FailureMessage).Should(ContainSubstring("At one point, however, the function did return successfully.\nYet, Eventually failed because the matcher returned the following error:\nmatcher-err")) }) }) @@ -1611,7 +1611,7 @@ sprocket: return actualInt > 3, nil }), "My Description") Ω(ig.FailureMessage).Should(ContainSubstring("My Description\nThe function passed to Eventually returned the following error:\nactual-err\n <*errors.errorString")) - Ω(ig.FailureMessage).Should(ContainSubstring("At one point, however, the function did return successfully. But Eventually failed because the matcher was not satisfied:\nQM failure message: 3")) + Ω(ig.FailureMessage).Should(ContainSubstring("At one point, however, the function did return successfully.\nYet, Eventually failed because the matcher was not satisfied:\nQM failure message: 3")) }) })