Open Naatan opened 5 years ago
I am not doing any unusual embedding with intermediary test suites. This is a regression.
go version go1.12.6 darwin/amd64
A quick (noisy) work-around:
--- a/vendor/github.com/stretchr/testify/suite/suite.go
+++ b/vendor/github.com/stretchr/testify/suite/suite.go
@@ -6,6 +6,7 @@ import (
"os"
"reflect"
"regexp"
+ "runtime/debug"
"testing"
"github.com/stretchr/testify/assert"
@@ -59,6 +60,7 @@ func failOnPanic(t *testing.T) {
r := recover()
if r != nil {
t.Errorf("test panicked: %v", r)
+ debug.PrintStack()
t.FailNow()
}
}
Looks like this was fixed months ago. It just hasn't been released yet. Though it's in master: https://github.com/stretchr/testify/commit/10a9f474263e7c93475ac7aa9f2661449fc45cb3
I've tested latest release v1.4.0 and it's fixed for me
When a panic occurs I'm seeing the following error:
suite.go:61: test panicked: runtime error: invalid memory address or nil pointer dereference
suite.go does not exist anywhere in my project, I'm not sure where it's coming from. If I have multiple panics they all show this file and line number.
My test suite struct itself inherits from an intermediary test suite which in turn inherits from the testify test suite, I suspect this might be related.
I think the problem here is that testify uses hard coded skip values for generating its trace.
I think there are 2 things that could (should) be done to address this: