###################################################################################################### # # # Shoutrrr Mockery Configuration # # # # Shoutrrr: https://github.com/nicholas-fedor/shoutrrr/ # # Mockery: https://vektra.github.io/mockery/latest/ # # Configuration: https://vektra.github.io/mockery/latest/configuration # # Mockery Major Version: 3.x.x # # # ###################################################################################################### ###################################################################################################### # Mockery Usage # # # # Install Mockery: # # go install github.com/vektra/mockery/v3@latest # # # # Run CLI command from root: # # mockery # # # # Expected Result: # # Mockery will recursively traverse through configured package locations, # # identify interfaces, and create 'mocks' subdirectories containing files # # named for the respective interface. # ###################################################################################################### ###################################################################################################### # Configuration Structure # # # # Config File Settings: Settings for locating and enabling the config file # # Logging Configuration: Options for controlling output verbosity and log levels # # Interface Discovery Configuration: Settings for finding and filtering interfaces to mock # # Mock Generation Configuration: Options for customizing the mock generation process # # File Output Configuration: Settings for naming and placing generated mock files # # Template Configuration: Settings for custom templates and template-specific options # # # ###################################################################################################### ###################################################################################################### # Config File Settings # ###################################################################################################### # YAML anchors placeholder for reusable configuration fragments. # Define anchors here to reference in other parts of the config. # Default: {} # _anchors: {} # Set the location of the mockery config file. # Overrides the default search paths (.mockery.yaml, mockery.yaml in current or parent dirs). # Default: "" # config: "" ###################################################################################################### # Logging Configuration # ###################################################################################################### # Set the logging verbosity level. # Options: debug (most verbose), info (standard), warn (warnings only), error (errors only). # Default: info # log-level: debug ###################################################################################################### # Interface Discovery Configuration # ###################################################################################################### # Defines the scope of packages to process for mock generation # Default: null packages: # Top-level pkg directory, recursively includes all subpackages github.com/nicholas-fedor/shoutrrr/pkg: {} # Top-level internal directory, recursively includes all subpackages github.com/nicholas-fedor/shoutrrr/internal: # Generate mocks for all exported interfaces within specified packages or directories. # When true with packages section, processes all interfaces in listed packages. # Default: false all: true # Limit mock generation to interfaces matching this regex. # Ignored if all: true; use with exclude-interface-regex for finer control when all: false. # Default: "" # include-interface-regex: "" # Exclude interfaces matching this regex when include-interface-regex is set. # Only effective with include-interface-regex and all: false; ignored otherwise. # Default: "" # exclude-interface-regex: "" # Scan subdirectories recursively for interfaces within specified packages or directories. # Requires all: true or specific interface targeting to generate mocks. # Default: false recursive: true # Exclude specific subpackages from recursive discovery. # Applies when recursive: true; uses package import paths (e.g., "pkg/subpkg"). # Default: [] exclude-subpkg-regex: - "internal/testutils" # Include auto-generated files in package discovery when true. # When false, skips files matching Go's generated file convention (e.g., "// Code generated"). # Default: false # include-auto-generated: true ###################################################################################################### # Mock Generation Configuration # ###################################################################################################### # Selectively enable or disable mock generation. # When false, no mocks will be generated (useful for debugging or partial generation). # Default: true # generate: false # Specify build tags for the generated mock files. # Matches Go's build constraint syntax (e.g., "//go:build tag1 || tag2"). # https://pkg.go.dev/cmd/go#hdr-Build_constraints # Default: "" # build-tags: "" # Customize the struct name of the generated mock using a Go template. # Overrides the default "Mock{{.InterfaceName}}" naming convention. # Default: "Mock{{.InterfaceName}}" # structname: "" # Package name for generated mock files. # Default: "{{.SrcPackageName}}" pkgname: "mocks" ###################################################################################################### # File Output Configuration # ###################################################################################################### # Code formatter to use for generated mock files. # Options: gofmt (standard Go formatter), goimports (includes import management), noop (no formatting). # Default: goimports # formatter: "goimports" # Overwrite existing mock files when true. # When false, skips files that already exist on disk. # Default: false # force-file-write: true # Place mocks in the same package as the interface when true (not recommended). # Avoids creating a separate package; can lead to naming conflicts. # Default: null # inpackage: true # Define the output directory for mocks using a Go template. # "{{.InterfaceDir}}/mocks" places mocks in a subdirectory of the interface's source dir. # Default: "{{.InterfaceDir}}" dir: "{{.InterfaceDir}}/mocks" # Filename template using interface name. # Default: "mocks_test.go" filename: "{{.InterfaceName}}.go" ###################################################################################################### # Template Configuration # ###################################################################################################### # Template to use for generating mocks. # Available templates: "testify" (standard testify mocks), or path to custom template. # Default: "" template: "testify" # Map of template-specific options passed to the template engine. # Options vary by template; commonly includes boilerplate-file for license headers. # Default: {} # template-data: # # Specify a file containing boilerplate text (e.g., license headers) to prepend to all mocks. # # Path is relative to the config file or working directory. # # Default: "" # boilerplate-file: "" # JSON schema URL for validating template-data configuration. # Provides validation against template-specific options. # Default: "{{.Template}}.schema.json" # template-schema: "{{.Template}}.schema.json" # Fail if the template schema is unavailable when true. # Ensures strict validation of template-data against the schema. # Default: true # require-template-schema-exists: false # Type replacement map for substituting types in generated mocks. # Keys are original types, values are replacement types. # Default: {} # replace-type: {} ###################################################################################################### # End of Mockery Configuration # ######################################################################################################