Skip to content

v13.1.0 - The Require DSL

Compare
Choose a tag to compare
@younata younata released this 21 Dec 16:38
· 26 commits to main since this release
v13.1.0

Highlights

New Features

  • Introduce the require dsl. This throws an error (a RequireError, or a custom one) if the matcher used with it fails. If the matcher doesn't fail, then the require dsl will return the result of the expression.
    • For example, try require([1, 2, 3]).to(haveCount(3)) will return [1, 2, 3]. However try require(2).toEqual(1)) will throw a RequireError.
    • When the matcher fails, require will still register the assertion failure with XCTest.
    • This also adds unwrap and pollUnwrap, which are work as try require(...).toNot(beNil()) and try require(...).toEventuallyNot(beNil()). With both sync and async variants. They either throw, or return non-optional versions of the expression.
    • See the documentation here for more.

Deprecations

  • Removes Expectation.onFailure, as the new require dsl entirely replaces that API. This deprecation will persist through Nimble 14, before being marked as removed in Nimble 15 and fully removed in Nimble 16.

Breaking Changes

  • The throwAssertion matcher no longer supports watchOS and tvOS in the cocoapods distribution of Nimble. This is because Nimble no longer directly embeds the CwlCatchException CwlPreconditionTesting libraries used in that matcher and instead Nimble pulls in those libraries transitively through the package manager used.

Automated Release Notes

What's Changed

  • Bump cocoapods from 1.13.0 to 1.14.2 by @dependabot in #1094
  • Introduce the require dsl. For when you need the assertion to pass before continuing by @younata in #1103
  • Pull in CwlCatchException and CwlPreconditionTesting transitively. by @younata in #1108

Full Changelog: v13.0.0...v13.1.0