-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
DefaultFormatter.fillGeneral tends to panic if called outside a unit test context #410
Comments
- Solves issue gavv#410
Note that this issue probably can't be unit tested, since it relies on not running |
Thanks for detailed report and PR! Merged. BTW what is your use case that doesn't use |
I've found that go's unit test cache can be a hindrance when running e2e tests against backends that are not within the same repository as the test itself. The backend has changed, but the test will return cached results since the files it knows about remained unchanged. I've concluded that the I might be entirely wrong about this approach 😄 |
Oh, I see. A silly question, do you know about We can close the issue, right? |
Did not know about the |
This line causes a panic if you run httpexpect outside a standard go unit test context, since the
testing
package hasn't been imported and its init-function hasn't run:The issue can be replicated by creating a custom logger that implements the
httpexpect.TestingTB
interface, and passing it tohttpexpect.Default
:The issue can be sidestepped by instead using
httpexpect.WithConfig
, and passing ahttpexpect.DefaultFormatter
that usesColorModeAlways
orColorModeNever
:One way to fix this would be to check
flag.Parsed()
before callingtesting.Verbose()
:The text was updated successfully, but these errors were encountered: