Add support for BDD style expectations
Author: Nokel81Created May 27, 2026Updated Jul 11, 2026
Proposal
Add support for blocking on consuming expectations until an expectation has been declared. Internally it would use a channel instead of an array of expectations. It would also imply MatchExpectationsInOrder.
var mock sqlmock.Sqlmock
...
mock.BlockExpectationsUntilExpected(true)
Use-cases
This is for BDD style testing where most of the configurations of expectations are done sequentially in BeforeEach's (such as from "github.com/onsi/ginkgo/v2") and then the individual tests are each very small with a single Expect call
Source: DATA-DOG/go-sqlmock