Skip to content

Instantly share code, notes, and snippets.

@ChrisLawther
Created July 1, 2020 17:33
Show Gist options
  • Save ChrisLawther/6eaf81c5a588e0ff33632fb916a4de63 to your computer and use it in GitHub Desktop.
Save ChrisLawther/6eaf81c5a588e0ff33632fb916a4de63 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Run in the top directory of an SPM project to have unit tests run every time you save
# changes to a .swift file
#
# Prerequisites: fswatch, available vi `brew install fswatch`
# Test stuff now
swift test 2>&1 | xcpretty 2>/dev/null
# ... and everytime a .swift changes
(fswatch -o -e ".*" -i "\\.swift$" . | xargs -n1 -I{} swift test ) 2>&1 | xcpretty 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment