.pre-commit-config.yaml for running encore tests #1555
echarrod
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I frequently found my deploys were broken because of a failing test, which I didn't realise for a little while.
Adding to pre-commit allows you to "shift left" the failures, so they are caught earlier, at commit time.
This is for use with https://pre-commit.com/, but I'm interested to hear how others have solved this.
Using the custom
my-cmd-mod
command provided on https://github.com/TekWizely/pre-commit-golang:This does run all of the tests. Ideally we'd only run the tests for the changed packages, but I couldn't get it to work like that, as I'm not sure if we could "skip" the non-encore packages (if there are any).
This is similar to how the "go test" hook works, and
-mod
above can be substituted for the other prefixed below:go-test
Automates testing, printing a summary of test results.
go-test-mod
'cd $(mod_root $FILE); go test [$ARGS] ./...'
for each staged .go filego-test-pkg
'go test [$ARGS] ./$(dirname $FILE)'
for each staged .go filego-test-repo-mod
'cd $(mod_root); go test [$ARGS] ./...'
for each module in the repogo-test-repo-pkg
'go test [$ARGS] ./...'
in repo root folderBeta Was this translation helpful? Give feedback.
All reactions