From 818b78c1701e3e4c8f7cf360aa94a0758d3b9e08 Mon Sep 17 00:00:00 2001 From: Onsi Fakhouri Date: Wed, 26 Oct 2022 06:28:29 -0600 Subject: [PATCH] AsyncAssertions emit the format.Object representation of the error when it is not a PolilngSignalError --- internal/async_assertion.go | 2 +- internal/async_assertion_test.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/internal/async_assertion.go b/internal/async_assertion.go index 044acc761..c1e4a9995 100644 --- a/internal/async_assertion.go +++ b/internal/async_assertion.go @@ -357,7 +357,7 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch message += format.Object(attachment.Object, 1) } } else { - message = "Error: " + err.Error() + message = "Error: " + err.Error() + "\n" + format.Object(err, 1) } } else { if desiredMatch { diff --git a/internal/async_assertion_test.go b/internal/async_assertion_test.go index 338eb2ae3..82423a725 100644 --- a/internal/async_assertion_test.go +++ b/internal/async_assertion_test.go @@ -1228,10 +1228,19 @@ sprocket: widget: : bob sprocket: - : 17`)) + : 17`)) }) }) + + Context("when a non-PollingSignalError is in play", func() { + It("also includes the format.Object representation", func() { + ig.G.Eventually(func() (int, error) { + return 0, fmt.Errorf("bam") + }).WithTimeout(10 * time.Millisecond).Should(Equal(1)) + Ω(ig.FailureMessage).Should(ContainSubstring("*fmt.wrapError")) + }) + }) }) Describe("The StopTrying signal - when sent by the matcher", func() {