#1153·mockery

Feature Request: A Wait() method for waiting for all expected calls

Author: ar-sematellCreated Apr 2, 2026Updated Apr 2, 2026

Summary

Sometimes, when using error groups or go routines, we expect certain calls to happen asynchronously. On the latest go version, with the introduction of synctest, it's possible to make the test runtime itself to wait for all go routines to end.

It would be highly practical to not have to use synctest for this functionality. Instead, using a .Wait() or similar, maybe even provided a maximum waiting time, so the call will block until the expectations are met.

Example:

go
myMock.EXPECT().CallName().Return(nil)
run(myMock)
myMock.WaitExpectations(5 * time.Second)