Skip to content

Commit 8485d66

Browse files
committed
CONTRIBUTING: document mocks + mockery usage
1 parent fc1c9f6 commit 8485d66

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ Strings inside `quickshell/DankCommon/` are owned by the dank-qml-common repo bu
169169
4. Run `go mod tidy`
170170
5. Open pull request
171171

172+
#### Mocks
173+
174+
Test mocks under `core/internal/mocks/` are generated with [mockery](https://vektra.github.io/mockery/) v3. Don't edit them by hand, regenerate after changing a mocked interface:
175+
176+
```bash
177+
cd core
178+
go run github.com/vektra/mockery/v3@latest
179+
# or with it installed (go install github.com/vektra/mockery/v3@latest):
180+
mockery
181+
```
182+
183+
`core/.mockery.yml` lists every mocked interface and where its mock goes (e.g. `network.Backend` -> `internal/mocks/network/mock_Backend.go`). To mock a new interface, add it there under its package and regenerate.
184+
172185
## Pull request
173186

174187
Include screenshots/video if applicable in your pull request if applicable, to visualize what your change is affecting.

0 commit comments

Comments
 (0)