Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make stacktrace on error optional #566

Open
divan opened this issue Mar 17, 2019 · 3 comments
Open

Make stacktrace on error optional #566

divan opened this issue Mar 17, 2019 · 3 comments

Comments

@divan
Copy link

divan commented Mar 17, 2019

Hey, after upgrading to the latest GoConvey version (due to Go 1.12 issue), I noticed that test verbose output generates stacktraces. This change was introduced in this PR #531

I usually prefer to run tests in verbose mode, and in 99.99% cases don't care about stacktrace at this moment, as usually it's enough information to spot the problem. If I need to dig deeper into the problem and to debug it, I use debugging and/or print stacktrace manually.

So this change converts a nice familiar error output I've used over the years of using Goconvey:

Failures:

  * /path/to/my/file_test.go
  Line 18:
  Expected: true
  Actual:   false

1 total assertion

into the text where stacktrace takes most of the space and also convey a little value, as most of the traces are from GoConvey source:

Failures:

  * /path/to/my/file_test.go
  Line 18:
  Expected: true
  Actual:   false
  goroutine 18 [running]:
  github.com/user/project.TestValidate.func1.1()
  	/path/to/my/file_test.go:18 +0x130
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
  	/Users/divan/src/github.com/jtolds/gls/context.go:97 +0x40d
  github.com/jtolds/gls.EnsureGoroutineId(0xc000086690)
  	/Users/divan/src/github.com/jtolds/gls/gid.go:19 +0x108
  github.com/jtolds/gls.(*ContextManager).SetValues(0xc0000843b0, 0xc000086630, 0xc0000821a0)
  	/Users/divan/src/github.com/jtolds/gls/context.go:63 +0x14b
  github.com/user/project.TestValidate.func1()
  	/path/to/my/file_test.go:13 +0x433
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
  	/Users/divan/src/github.com/jtolds/gls/context.go:97 +0x40d
  github.com/jtolds/gls.EnsureGoroutineId.func1()
  	/Users/divan/src/github.com/jtolds/gls/gid.go:24 +0x2e
  github.com/jtolds/gls._m(0x0, 0xc000082140)
  	/Users/divan/src/github.com/jtolds/gls/stack_tags.go:108 +0x31
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x0, 0xc000082140)
  	/Users/divan/src/github.com/jtolds/gls/stack_tags.go:56 +0x35
  github.com/jtolds/gls.addStackTag(...)
  	/Users/divan/src/github.com/jtolds/gls/stack_tags.go:49
  github.com/jtolds/gls.EnsureGoroutineId(0xc000086450)
  	/Users/divan/src/github.com/jtolds/gls/gid.go:24 +0xd6
  github.com/jtolds/gls.(*ContextManager).SetValues(0xc0000843b0, 0xc0000863f0, 0xc000082100)
  	/Users/divan/src/github.com/jtolds/gls/context.go:63 +0x14b
  github.com/user/project.TestValidate(0xc0000c0100)
  	/path/to/my/file_test.go:11 +0x99
  testing.tRunner(0xc0000c0100, 0x11876d8)
  	/usr/local/go/src/testing/testing.go:865 +0xc0
  created by testing.(*T).Run
  	/usr/local/go/src/testing/testing.go:916 +0x357

1 total assertion

That's a serious change in terms of readablity of GoConvey output.

Can it be reverted and reconsidered to be an optional feature (in a way similar to SetFailureMode or something like that)?

@solarfly73
Copy link

No comment/update on this for a year? I agree that a full trace isn't necessary for the vast majority of debugging and should be an option. Any status?

@miketonks
Copy link
Contributor

I agree the new behavior is not what we want here. I did a PR for this keeping the new behavior as an option, see: #588

But not response in a long time. Would be good to see this resolved.

@ezk84
Copy link
Contributor

ezk84 commented Dec 4, 2020

Keen to see this merged 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants