gomega v1.2.0 Release Notes

  • ๐Ÿ‘Œ Improvements:

    • โž• Added BeSent which attempts to send a value down a channel and fails if the attempt blocks. Can be paired with Eventually to safely send a value down a channel with a timeout.
    • โœ… ฮฉ, Expect, Eventually, and Consistently now immediately panic if there is no registered fail handler. This is always a mistake that can hide failing tests.
    • Receive() no longer errors when passed a closed channel, it's perfectly fine to attempt to read from a closed channel so ฮฉ(c).Should(Receive()) always fails and ฮฉ(c).ShoudlNot(Receive()) always passes with a closed channel.
    • โž• Added HavePrefix and HaveSuffix matchers.
    • ghttp can now handle concurrent requests.
    • โž• Added Succeed which allows one to write ฮฉ(MyFunction()).Should(Succeed()).
    • ๐Ÿ‘Œ Improved ghttp's behavior around failing assertions and panics:
      • If a registered handler makes a failing assertion ghttp will return 500.
      • If a registered handler panics, ghttp will return 500 and fail the test. This is new behavior that may cause existing code to break. This code is almost certainly incorrect and creating a false positive.
    • ghttp servers can take an io.Writer. ghttp will write a line to the writer when each request arrives.
    • โž• Added WithTransform matcher to allow munging input data before feeding into the relevant matcher
    • โž• Added boolean And, Or, and Not matchers to allow creating composite matchers
    • โž• Added gbytes.TimeoutCloser, gbytes.TimeoutReader, and gbytes.TimeoutWriter - these are convenience wrappers that timeout if the underlying Closer/Reader/Writer does not return within the alloted time.
    • โž• Added gbytes.BufferReader - this constructs a gbytes.Buffer that asynchronously reads the passed-in io.Reader into its buffer.

    ๐Ÿ› Bug Fixes:

    • gexec: session.Wait now uses EventuallyWithOffset to get the right line number in the failure.
    • ContainElement no longer bails if a passed-in matcher errors.