-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
panic is hidden if there are any failed expectations #63
Comments
may be linked to #59 |
func (e *EnrichedReporter) StackTraceErrorf(format string, args ...any) {
s := NewStackTrace()
result := fmt.Sprintf(format, args...)
var st string
if e.cfg.PrintStackTrace {
st = fmt.Sprintf(`At:
%s
Cause:
%s
Trace:
%s
`, s.CallerLine(), result, s.WithoutLibraryCalls().String())
} else {
st = fmt.Sprintf(`At:
%s
Cause:
%s
`, s.CallerLine(), result)
}
fmt.Println(st)
// e.reporter.Fatalf(st)
} changing the last line to a simple print showed me the panic here is some related issues i found about this topic |
switching to ErrorF instead of FatalF seems to solve the issue but this should have been fixed in the go std lib so i am a but confused // ErrorReporter is an interface for reporting errors during test execution.
// Implementations of this interface should provide a way to fail the test with a message.
type ErrorReporter interface {
// Fatalf reports an error and fails the test execution.
// It formats the message according to a format specifier and arguments
// It can be used to report an error and provide additional context about the error.
Fatalf(format string, args ...any)
Errorf(format string, args ...any)
// Cleanup adds hooks that are used to clean up data after test was executed.
Cleanup(func())
} |
Thanks for pointing that out. |
The problem is not that trivial as it turned out.
Can you please review PR and maybe add some suggestions? |
Some tests would be appreciated, as it is quite a weird case |
Closed the issue, fixed in |
this unit test shows the issue, the test without the mock reporter will not show the panic and will instead report a fail expectation.
The text was updated successfully, but these errors were encountered: