gl-react/tests/flow/test.sh
Gaëtan Renaudeau 4600bcedd0 initial release
2016-12-02 10:55:17 +01:00

26 lines
651 B
Bash
Executable File

#!/bin/bash
cd `dirname $0`
flow --quiet &> test_dump.tmp
if [ ! -f snapshot.txt ]; then
echo "✓ Flow types: created a new snapshot file."
mv test_dump.tmp snapshot.txt
else
if ! cmp -s test_dump.tmp snapshot.txt; then
if [ "$1" == "-u" ]; then
echo "✕ snapshot differs! recreated as requested by -u"
mv test_dump.tmp snapshot.txt
else
diff test_dump.tmp snapshot.txt
rm test_dump.tmp
echo "✕ Failed: Flow types didn't match snapshot! Recreate with ` npm run test-rewrite-snapshots `" >&2;
exit 1
fi
else
echo "✓ Flow types matches snapshot!"
echo
rm test_dump.tmp
fi
fi