Last active
July 11, 2021 21:04
-
-
Save chriscz/9cf5e72c75d30f644f7b321e9729d237 to your computer and use it in GitHub Desktop.
Crystal Makefile which runs tests when files change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires inotify-tools to be installed. On Ubuntu / Debian: | |
# sudo apt install inotify-tools | |
CRYSTAL=crystal | |
TEST_ARGS=--chaos --parallel 4 --verbose | |
SPEC_ARGS=--order=random --error-on-warnings --verbose | |
WATCH=src/**/*.cr spec/**/*.cr test/**/*.cr | |
# The make rule to use when running tests. Either spec or test | |
TEST_RULE=test | |
.PHONY: spec watch test | |
spec: | |
crystal spec $(SPEC_ARGS) | |
test: | |
bash -c 'shopt -s globstar; $(CRYSTAL) run test/**/*_test.cr -- $(TEST_ARGS)' | |
watch: | |
bash -c 'shopt -s globstar; while true; do inotifywait -e close_write $(WATCH); $(VERBOSE) make $(TEST_RULE); done' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment