Create a Cuckoofile.toml file at the root of your project to configure mock generation.
For CuckooPluginSingleFile
You can define a global output and specific [modules.<ModuleName>] configurations. Each module can specify its own output, imports, publicImports, testableImports, sources, exclude patterns, and regex filters. You can also configure options like keepDocumentation and omitHeaders.
For CuckooPluginModular
This plugin is recommended for Swift Packages with multiple targets. It generates a separate GeneratedMocks_<ModuleName>.swift for each dependency. You must provide a [modules.<TargetName>] entry for every module you want to mock. The plugin matches the entry name to the test target's name (e.g., [modules.TargetATests]).
# You can define a fallback output for all modules that don't define their own.
output = "Tests/Swift/Generated/GeneratedMocks.swift"
[modules.MyProject]
output = "Tests/Swift/Generated/GeneratedMocks+MyProject.swift"
# Standard imports added to the generated file(s).
imports = ["Foundation"]
# Public imports if needed due to imports being internal by default from Swift 6.
publicImports = ["ExampleModule"]
# @testable imports if needed.
testableImports = ["RxSwift"]
sources = [
"Tests/Swift/Source/*.swift",
]
exclude = ["ExcludedTestClass"]
# Optionally, you can use a regular expression to filter only specific classes/protocols.
# regex = ""
[modules.MyProject.options]
# glob = false
# Docstrings are preserved by default, comments are omitted.
keepDocumentation = false
# enableInheritance = false
# protocolsOnly = true
# omitHeaders = true
# If specified, Cuckoo can also get sources for the module from an Xcode target.
[modules.MyProject.xcodeproj]
# Path to folder with .xcodeproj, omit this if it's at the same level as Cuckoofile.
path = "Generator"
target = "Cuckoonator"
# You can define as many modules as you need, each with different sources/options/output.
[modules.AnotherProject]
# ...