Switch mock generation from **moq** to **mockery** (build-tag test) markdown#877
Switch mock generation from **moq** to **mockery** (build-tag test) markdown#877reject-i wants to merge 3 commits intoNilFoundation:mainfrom
test) markdown#877Conversation
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.
Did you try to build a project?
.gitignore
Outdated
| .qodo | ||
| nil/**/mock_*.go | ||
|
|
||
| # mockery output (исключаем helper-тесты) |
There was a problem hiding this comment.
Usually we write comments in English even we use AI tools
.gitignore
Outdated
| .qodo | ||
| nil/**/mock_*.go | ||
|
|
||
| # mockery output (исключаем helper-тесты) |
There was a problem hiding this comment.
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.
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.
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? |
|
@reject-i do you plan to correct the comments? |
|
@Un1oR ready, thanks |
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 mockeryand rungo generate.make mocks.Closes #852