purescript-spec-mocha/run_tests.sh
2017-10-04 08:14:49 +02:00

30 lines
523 B
Bash
Executable File

#!/bin/bash
set -e
mkdir -p output
pulp browserify -I test --main Test.Main --to output/bundle.js
$(mocha output/bundle.js > output/test-output.txt) || echo "Checking test output..."
fail() {
echo -e "\nTests output:\n"
cat output/test-output.txt
exit 1
}
test_single() {
str="$1"
echo -n "${str}? "
if ! grep -q "$str" output/test-output.txt; then
echo "Nope."
fail
else
echo "Yes!"
fi
}
test_single "2 passing"
test_single "1 pending"
test_single "2 failing"