From 10a9f474263e7c93475ac7aa9f2661449fc45cb3 Mon Sep 17 00:00:00 2001 From: Sergej Zagursky Date: Mon, 11 Feb 2019 17:50:19 +0300 Subject: [PATCH] Show stack trace on panic --- suite/suite.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/suite/suite.go b/suite/suite.go index 5db290d..d708d7d 100644 --- a/suite/suite.go +++ b/suite/suite.go @@ -6,6 +6,7 @@ import ( "os" "reflect" "regexp" + "runtime/debug" "testing" "github.com/stretchr/testify/assert" @@ -58,7 +59,7 @@ func (suite *Suite) Assert() *assert.Assertions { func failOnPanic(t *testing.T) { r := recover() if r != nil { - t.Errorf("test panicked: %v", r) + t.Errorf("test panicked: %v\n%s", r, debug.Stack()) t.FailNow() } }