You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I deemed the compound module concept as useless for now.
If we want to import protocol with an identical name from different targets, we should work on prefixing them with their target name in the generated mocks.
Copy file name to clipboardExpand all lines: README.md
+21-37Lines changed: 21 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -133,63 +133,47 @@ target = "Cuckoonator"
133
133
134
134
#### For CuckooPluginModular
135
135
136
-
When using `CuckooPluginModular`, the plugin automatically detects source modules from your test target's dependencies and generates a dedicated mock file for each one (`GeneratedMocks_<ModuleName>.swift`). It supports compound module names (`TARGET/MODULE`) in `Cuckoofile.toml`so that different test targets can customize mock generation for shared dependencies.
136
+
When using `CuckooPluginModular`, the plugin collects every source module dependency of your test target (excluding Cuckoo) and runs the generator once per module, producing a separate `GeneratedMocks_<ModuleName>.swift` file for each one. It also runs the generator for the test target's own name, so you can add a `[modules.<TestTargetName>]` entry in `Cuckoofile.toml`to control exactly which files are mocked and which imports are added. If no matching entry exists in the configuration, that module is silently skipped.
137
137
138
138
**Example `Cuckoofile.toml` for modular projects:**
139
139
140
140
```toml
141
-
#CoreModule mocks
142
-
[modules.CoreModuleTests]
141
+
#TargetA mocks
142
+
[modules.TargetATests]
143
143
imports = ["Foundation"]
144
-
testableImports = ["CoreModule"]
144
+
testableImports = ["TargetA"] #ProtocolA is internal to TargetA
-**Multiple modules define protocols/types with identical names** (e.g., both `ModuleA` and `ModuleB` have a `ServiceProtocol`)
190
-
- Different test targets need different subsets of mocks from the same module
191
-
- You want to organize and namespace mocks by test target for clarity
192
-
193
177
### 3. Usage
194
178
Usage of Cuckoo is similar to [Mockito](http://mockito.org/) and [Hamcrest](http://hamcrest.org/). However, there are some differences and limitations caused by generating the mocks and Swift language itself. List of all the supported features can be found below. You can find complete examples in [tests](Tests).
0 commit comments