testify icon indicating copy to clipboard operation
testify copied to clipboard

proposal: print full path when displaying error location

Open EwenQuim opened this issue 3 years ago • 0 comments

Currently, the error indicates only the file name, not the full path.

Example:

         event_test.go:46: 
                Error Trace:    event_test.go:46
                Error:          Received unexpected error:

It bothers me because I have the same file name within different packages (/model/event.go, /query/event.go), and my IDE can not identify uniquely the file.

Desired output:

         query/event_test.go:46: 
                Error Trace:    query/event_test.go:46
                Error:          Received unexpected error:

Or:

         /home/xxx/dev/project/query/event_test.go:46: 
                Error Trace:    /home/xxx/dev/project/query/event_test.go:46
                Error:          Received unexpected error:

I guess something could be done on the testify source code near assert/assertions.go:151, but doing it in a backward-compatible way will be difficult. I don't know if is is something that the maintainers want. If it is, I'm ready to work on a PR.

EwenQuim avatar Apr 22 '22 14:04 EwenQuim