Skip to content

Releases: JosiahWitt/ensure

CLI: Internal cleanup refactor

01 May 23:24
d2d56f9
Compare
Choose a tag to compare

Deletes some unnecessary code (#53).

Make Equals concurrent safe

27 Mar 21:36
ed70c0a
Compare
Choose a tag to compare

Any updates to global deep settings are now wrapped in a mutex to prevent triggering the race detector.

CLI: Fix paths for v2+ packages

06 Mar 23:54
a0653a9
Compare
Choose a tag to compare

If a mock is generated for a v2+ package, it will now be a usable package path. For example, github.com/hello/world/v2 is generated as github.com/hello/world/v2/mock_world.

Internal changes related to CLI release

17 Jan 17:49
99fb4a5
Compare
Choose a tag to compare
Merge pull request #48 from JosiahWitt/cli-v2

CLI mock generation refactor

CLI: Refactored mock generation

17 Jan 18:00
99fb4a5
Compare
Choose a tag to compare

Now the ensure CLI is included in the ensure repo. This release contains a refactor of the ensure mocks generate command resulting in a huge performance boost. Instead of relying on the mockgen CLI, which generates several tiny programs that use reflection, it leverages Go's AST parsing package.

A few breaking changes to note for the ensure mocks generate command:

  • --disable-parallel flag has been removed, since the CLI doesn't run anything in parallel anymore
  • tidyAfterGenerate in .ensure.yml now defaults to true instead of false
  • ensure generate mocks alias to ensure mocks generate has been removed

Expose the original *testing.T with ensure.T()

10 Sep 14:38
0c17928
Compare
Choose a tag to compare

Now calling ensure.T() returns the type *testing.T instead of an interface.

Improve silenced panics

28 Jun 23:51
2761c25
Compare
Choose a tag to compare

Nested ensure.New support

18 Jun 20:23
fd3a99f
Compare
Choose a tag to compare

Allow created a new instance of ensure with a different testing context when th ensure package has been shadowed by the ensure variable.

For example:

ensure := ensure.New(t)

// ...

t.Run("important tests", func(t *testing.T) {
  ensure := ensure.New(t)

  // ...
})

Add MatchesAllErrors Chainer

26 Apr 00:03
f4e3079
Compare
Choose a tag to compare

To validate than an error is multiple errors, use:

ensure(err).MatchesAllErrors(user.ErrCreateUserFailed, store.ErrPutItemFailed)

Make Equals stricter and add MatchesRegexp chainer

02 Apr 14:10
85dbc0c
Compare
Choose a tag to compare
  • Now Equals treats nil and empty maps and slices as not equal (maybe a slight breaking change, but is safer)
  • MatchesRegexp chainer added to allow matching strings against regular expressions