Changelog History
Page 1
-
v0.16.0 Changes
October 08, 2020Targets
- Xcode 12.0 / Swift 5.3
- π iOS 8.0+, macOS 10.14+, tvOS 9.0+
Migrating from 0.15
Thunk Pruning
The generator flag
--disable-thunk-stubs
has been replaced with the option--prune [disable|stub|omit]
. Specifydisable
for the thunk pruning method to reproduce the previous flag behavior.Level Description β disable
stub
Generate partial definitions filled with fatalError
.omit
Donβt generate any definitions for unused types. π New Features
- β Added the ability to pass ad hoc JSON project descriptions to the generator instead of a
.xcodeproj
file (#171)
Andrew Chang - β Added a thunk pruning option to fully exclude unused types from generating thunks (#174)
Andrew Chang - Added support for setting
GH_ACCESS_TOKEN
to address rate limiting when downloading prebuilt binaries (#169)
Andrew Chang
β¨ Enhancements
- π Improved support for Xcode 12 / Swift 5.3 and upgraded all dependency versions (#168)
Andrew Chang - π Improved handling of module names shadowed by top level nominal types (#172)
Andrew Chang
-
v0.15.0 Changes
August 13, 2020Targets
- Xcode 11.6 / Swift 5.2
- π iOS 8.0+, macOS 10.14+, tvOS 9.0+
Migrating from 0.14
π€‘ Generic Mock Initialization
π This release unifies the mock initialization API for generic types.
class MyClass {}protocol MyProtocol {}class MyGenericClass\<T\> {}protocol MyGenericProtocol { associatedtype T}// Oldmock(MyClass.self)mock(MyProtocol.self)mock(MyGenericClassMock\<Bool\>.self)mock(MyGenericProtocolMock\<Bool\>.self)// Newmock(MyClass.self) // no changemock(MyProtocol.self) // no changemock(MyGenericClass\<Bool\>.self)mock(MyGenericProtocol\<Bool\>.self)
Value Provider Semantics
Value provider has been simplified and no longer allows for hierarchical composition and decomposition.
// Oldvar provider = ValueProvider() provider.addSubprovider(.standardProvider) provider.removeSubprovider(.standardProvider)// New (mutating)var provider = ValueProvider() provider.add(.standardProvider)// New (non-mutating)let provider = ValueProvider() + .standardProviderlet provider = ValueProvider().adding(.standardProvider)
π New Features
- π€‘ Unified generic mock initialization for classes and protocols (#157)
Andrew Chang | Jierong Li - π Improved ValueProvider value semantics (#159)
Andrew Chang - β Added custom header option to generator (#158)
Andrew Chang | Ryan Meisters
β¨ Enhancements
- β‘οΈ Updated code signing certificates and added CI action to build signed artifacts on commit with audit trail (#104)
Andrew Chang | Ryan Meisters
-
v0.14.1 Changes
July 30, 2020Patch Notes
- π Fixed full thunks not being generated for generic types (#156)
Andrew Chang | Jierong Li - π Fixed full thunks not being generated for referenced types in newly added test files (#161)
Andrew Chang | Alfredo - π Fixed CocoaPods not including the downloaded prebuilt binary (#160)
Andrew Chang | Luke | Ben Findeisen
- π Fixed full thunks not being generated for generic types (#156)
-
v0.14.0 Changes
July 15, 2020Targets
- Xcode 11.5 / Swift 5.2
- π iOS 8.0+, macOS 10.14+, tvOS 9.0+
Migrating from 0.13
π Thanks to Joe Tennant and various partners for testing this monthβs 0.14 release candidate. If youβd like to help with a future release or add your project to Mockingbirdβs source compatibility tests, please reach out on Slack.
Explicit Stubbing Syntax
π To make the framework more accessible to all users, this release introduces an explicit stubbing syntax that uses named methods instead of global operators. Although the explicit stubbing syntax will be the default in documentation going forward, the
~>
stubbing operator will continue to exist as the shorthand notation.The explicit stubbing syntax is a 1:1 match with the stubbing operator, so switching between the two notations is very intuitive.
// Explicit stubbing syntaxgiven(bird.canChirp()).willReturn(true)given(bird.canChirp()).willThrow(BirdError())given(bird.canChirp(volume: any())).will { volume inreturn volume \< 42}// Shorthand stubbing operatorgiven(bird.canChirp()) ~\> truegiven(bird.canChirp()) ~\> { throw BirdError() }given(bird.canChirp(volume: any())) ~\> { volume inreturn volume \< 42}
π As part of the explicit stubbing syntax addition, this release also includes an API reference generated from HeaderDoc comments: https://birdrides.github.io/mockingbird/latest/
Fast Compilation with Thunk Stubs
β To reduce compilation time, Mockingbird now only generates mocking code (known as thunks) for types referenced in tests with
mock(SomeType.self)
. Types not used in any test files produce minimal generated code in the form of βthunk stubs,β which are simply bodies containingfatalError
. Projects that indirectly synthesize mocked types, such as through Objective-C based dependency injection, may incorrectly encounter thunk stubs during tests and require special consideration.- Option 1: Explicitly reference each indirectly synthesized type in your tests, e.g.
_ = mock(SomeType.self)
. References can be placed anywhere in the test target sources, such as in thesetUp
method of a test case or in a single file. - Option 2: Disable thunk stubs entirely by adding the
--disable-thunk-stubs
generator flag.
π New Features
- β Added explicit stubbing syntax (#138)
Andrew Chang | Sterling Hackley | Ryan Meisters - β Added system to generate thunks dynamically from used mocks (#146)
Andrew Chang - β Added generated documentation from HeaderDoc comments using SwiftDoc (#141)
Andrew Chang
β¨ Enhancements
- π Fixed regression in recording throwing invocations (#148)
Andrew Chang | Joe Tennant - π Improved missing stub implementation test failure message by including invocation stack trace and examples (#142)
Andrew Chang - π Fixed missing return type in ordering logic (#145)
Andrew Chang - π Improved SPM installation instructions (#147)
Andrew Chang - π Improved documentation for class mocks and unavailable mocks (#149)
Andrew Chang
-
v0.13.1 Changes
June 23, 2020Patch Notes
- π Fixed regression in recording invocations to throwing methods stubbed to throw errors
Andrew Chang | Joe Tennant
- π Fixed regression in recording invocations to throwing methods stubbed to throw errors
-
v0.13.0 Changes
June 09, 2020Targets
- Xcode 11.4 / Swift 5.2
- π iOS 8.0+, macOS 10.14+, tvOS 9.0+
Migrating from 0.12
π€‘ Mocks for types without designated initializers and conforming to
NSObjectProtocol
now correctly inherit the designated initializer fromNSObject
and must be initialized with.initialize()
protocol MyProtocol: NSObjectProtocol {}// Oldmock(MyProtocol.self)// Newmock(MyProtocol.self).initialize()
π New Features
- β Added ability to provide wildcard generic Swift types in a ValueProvider (#122)
Andrew Chang | Ryan Meisters - β Added support for stubbing a sequence of implementations using closures (#120)
Andrew Chang | Luke
β¨ Enhancements
- π Fixed regression in merging inherited members (#119)
Andrew Chang | Pavel Ivashkov - π Fixed verification for methods overloaded via generic return type (#120)
Andrew Chang - π Fixed handling of nested type aliases in protocols (#128)
Andrew Chang | Pavel Ivashkov - π Improved automatic conformance of protocols like
NSObjectProtocol
(#127)
Andrew Chang | Harold Sun - β Added support for expression evaluation when parsing Xcode build settings for product module names (#133)
Andrew Chang | Luke - π Improved generic type specialization (#132)
Andrew Chang | Paul Wagener - π Fixed handling of non-initializable class mocks with private designated initializers (#134)
Andrew Chang | Paul Wagener - π Fixed compatibility with projects using Swift Package Manager and SwiftUI (#137)
Andrew Chang | Chris Wooden - π€‘ Made CI-safe path relative to executable path (#115)
Andrew Chang
-
v0.12.2 Changes
May 27, 2020Patch Notes
- π Fix uniqueness and equality operators for parsed type models causing issues with duplicate inherited member types
Andrew Chang
- π Fix uniqueness and equality operators for parsed type models causing issues with duplicate inherited member types
-
v0.12.1
May 07, 2020 -
v0.12.0 Changes
May 07, 2020Targets
- Xcode 11.4 / Swift 5.2
- π iOS 8.0+, macOS 10.14+, tvOS 9.0+
Migrating from 0.11
π€‘ Mocking class constrained protocols without designated initializers now uses protocol mocking instead of class mocking
protocol MyProtocol: AnyObject {}// Oldmock(MyProtocol.self).initialize()// Newmock(MyProtocol.self)
π The convenience non-parameterized closure stubbing operator has been removed; convert implicit argument closure stubs to explicitly ignore arguments
// Oldgiven(myMock.doSomething(with: any())) ~> { print("Ignoring arguments") }// Newgiven(myMock.doSomething(with: any())) ~> { _ in print("Ignoring arguments") }
π New Features
- β Add ability to provide default values for unstubbed methods (#80)
Andrew Chang | Sterling Hackley | Ryan Meisters - β Add support for diagnostic warnings and errors that integrate with Xcodeβs buildtime issues in the sidebar (#102)
Andrew Chang - β Add asset download command to improve supporting source file setup, usage
$ mockingbird download starter-pack
(#101)
Andrew Chang - β Add sequential stubbing for returning a sequence of predefined values (#90)
Andrew Chang - β Add support for stubbing and verifying subscripts (#89)
Andrew Chang | Pavel Ivashkov
β¨ Enhancements
- π¨ Refactor import and compilation directive parsing to use SwiftSyntax, resulting in faster code generation (#92)
Andrew Chang - β
Uniquify default generated file names when using the installer by prefixing the test target name (#100)
Andrew Chang
π Bug Fixes
- π Fix compatibility with Swift 5.2 (#91)
Andrew Chang - π Fix stubbing methods without parameters by removing the non-parameterized closure stubbing operator (#86)
Andrew Chang | seven332 - π Fix generating convenience initializers for class constrained protocols without a declared designated initializer
Andrew Chang - π Fix handling bash-style variables in build settings, e.g.
${TARGET_NAME}
(#83)
Andrew Chang - π Fix type inference for string literals and initialized types assigned to properties in class mocks (#108)
Andrew Chang | Ryan Meisters - π Fix mocking classes with designated and synthesized initializers, e.g. from
Decodable
(#93)
Andrew Chang | Tristan Diependael - π Fix synchronization of collection types in CLI and framework (#106)
Andrew Chang - π Fix uninstaller not removing
.generated.swift
source files added by the installer (#100)
Andrew Chang
-
v0.11.1 Changes
April 10, 2020Patch Notes
- βͺ Revert enforcing correct usage of class and protocol mock initialization which can cause type inference to fail
Andrew Chang
- βͺ Revert enforcing correct usage of class and protocol mock initialization which can cause type inference to fail