-
Notifications
You must be signed in to change notification settings - Fork 50
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
Proposal: changes for next major release (v4) #257
Comments
Just my 2 cents below 😄
👍
I would suggest not including them in the assert package, one thing I like about this library is how simple and focused the Perhaps the package could just be called
👍
👍
It may be nice to have colored output as an option, similar to got. This looks really nice when running with e.g. Similarly with the struct diffs too 😄 I do also wonder if the One more little thing I'd change (I found this confusing), is not to alias |
Thank you for the feedback! I like the idea of using color to improve the visibility of the failure messages. With type constraints I think we'll be able to remove the type from the failure message text (Ex: Removing the aliasing of the
I've been trying to reduce the number of assert functions as much as possible. I think the ones we have now cover at least 95% of assertions. For the remaining few percent I think documenting patterns for using |
See also #266 (define a separate Go module for assert/cmd/gty-migrate-from-testify) (however I think that this doesn't need to wait for v4) |
Having the ability to pass in your own context would also be helpful (a la https://pkg.go.dev/os/exec#CommandContext). As a use case, it's handy to do the following: ctx, cancel := context.WithCancel(context.Background())
t.Cleanup(cancel)
... That way, any |
With the opportunity to use generics to improve the
assert
package (#255), we may want to release a new major version. This issue is to discuss and track changes that would require a major version bump, so that we can include all of them when the time is right.Change the signature of the
assert
, andassert/cmp
functions to use generics instead ofany
as the argument types (assert: use type constraints (generics) #255)Combine the
skip
,env
, andpoll
packages into a single new package. These packages are very small, and combining them into a single package should make it easier to usegotest.tools
by requiring fewer imports. I'm not sure what to name that package yet. They could be included as part of theassert
package, but the names don't read as well.Replace the
golden
package with aGoldenFile(t, filename)
function in theassert
package. assert: golden variables #237 added support for golden-like behaviour using expected values stored in a Go variable. We should be able to do something similar:Similar to golden variables, when called with
-update
,assert.Assert
should be able to detect that the expected argument is aGoldenFile
and use the actual value to update the specified filename.Maybe
icmd
could change to usecontext.Context
to set the timeout instead of atime.Duration
passed toWaitOnCommand
? Some way to pass a deadline/timeout usingcontext.Context
might be good.Are there other breaking changes we should consider? Anything in
fs
that could change now that the stdlib has anfs
package or because of generics?The text was updated successfully, but these errors were encountered: