Created
July 23, 2017 09:14
-
-
Save mustafatoker/481014e4e5a38a87fdcc5642c01f37d9 to your computer and use it in GitHub Desktop.
A little bash script to run tests when a file has been changed
This file contains hidden or 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
#!/usr/bin/env bash | |
function pw { | |
# Register the command you want to run when changes are detected here | |
run="clear && printf '\e[3J' && vendor/bin/phpunit" | |
# Retrieve the custom argments. If none are provided, default to "tests" | |
[[ -n $@ ]] && args=$@ || args="tests" | |
# Run the command first... | |
eval "$run $args" | |
# ...then start watching for changes—and run on change | |
watchman-make -p 'src/**/*.php' 'tests/**/*.php' \ | |
--make=$run \ | |
-t "$args" | |
} |
Author
mustafatoker
commented
Jul 23, 2017
- Install via https://facebook.github.io/watchman/
- Copy the function below into "nano ~/.bashrc" then run this command -> "source ~/.bashrc"
- Go to your tests suit and run "pw" command. No longer need to run "vendor/bin/phpunit" command on every change
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment