Skip to content

Instantly share code, notes, and snippets.

@madx
Last active August 29, 2015 14:04
Show Gist options
  • Save madx/2462ce6972aa79293efc to your computer and use it in GitHub Desktop.
Save madx/2462ce6972aa79293efc to your computer and use it in GitHub Desktop.
Test runner with tape + tap-dot
#!/bin/bash
TEST_FILES=`find test/ -name "*.js"`
run_tests() {
local tests="$@"
for test in $tests; do
echo -ne "\033[1;33m$test\033[0m"
tape $test | tap-dot
done
}
run_tests $TEST_FILES
inotifywait -qrm lib/ test/ -e CLOSE_WRITE | while read change; do
file=$(echo $change | cut -d' ' -f3-)
dir=$(echo $change | cut -d' ' -f1)
if [ ${dir%%/*} = "lib" ]; then
echo "Running all tests "
run_tests $TEST_FILES
else
echo "Running tests for $dir$file"
run_tests $dir$file
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment