-
Notifications
You must be signed in to change notification settings - Fork 43
Switch mock generation from **moq** to **mockery** (build-tag test
) markdown
#877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
test
) markdown Копіювати Редагуватиtest
) markdown
d65e913
to
180c964
Compare
|
|
||
.PHONY: $(root_relayer)/gen_l2_mocks | ||
$(root_relayer)/gen_l2_mocks: $(root_relayer)/embed_l2_abi | ||
cd $(root_relayer)/internal/l2 && go run github.com/matryer/moq -out l2_contract_generated_mock.go -rm -stub -with-resets . L2Contract | ||
cd $(root_relayer)/internal/l2 && mockery --name=L2Contract |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try to build a project?
@@ -85,3 +85,8 @@ openrpc.json | |||
.pnpm/ | |||
.pnpm-store/ | |||
.qodo | |||
nil/**/mock_*.go | |||
|
|||
# mockery output (исключаем helper-тесты) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually we write comments in English even we use AI tools
@@ -85,3 +85,8 @@ openrpc.json | |||
.pnpm/ | |||
.pnpm-store/ | |||
.qodo | |||
nil/**/mock_*.go | |||
|
|||
# mockery output (исключаем helper-тесты) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write all comments in English
nil/internal/vm: {} | ||
nil/services/rollup: {} | ||
|
||
include-regex: '^(Client|DB|RwTx|StateDBReadOnly|L1BlockFetcher)$' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still plenty of types used for mock generation which are not covered here
For instance, check this Makefile.inc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I see, mockery
has a completely different API for assertions in comparison to moq
So, all existing tests should also be adjusted
Do we really need to migrate to Regarding the Script invocation looks like that: //go:generate bash ../scripts/generate_mock.sh {InterfaceName} |
@zadykian I'll answer as the author of the original proposal) As far as I see, |
Should I apply all your suggestions? |
What’s inside
mock-build-tags: "test"
,inpackage
,with-expecter
).//go:generate moq …
with//go:generate mockery --name=…
.*_generated_mock.go
/*_moq_test.go
; added newmock_*.go
(guarded by//go:build test
).//go:generate mockery
and rungo generate
.make mocks
.Closes #852