Cleanup result message code in test-js-with-node.

Remove duplicate code after quick fix in passing returned code.

Fixes: #1489.
This commit is contained in:
Tomasz Kolek 2016-08-08 22:50:23 +02:00 committed by Tim Abbott
parent e1090118c5
commit 4a25b92298
1 changed files with 12 additions and 2 deletions

View File

@ -8,9 +8,11 @@ export PATH=$PATH:node_modules/.bin
INDEX_JS=frontend_tests/zjsunit/index.js
NODEJS=$(which nodejs || which node)
ret=0
if [ "$1" = "cover" ]; then
# Run a coverage test with Istanbul.
istanbul cover "$INDEX_JS" && echo "Test(s) passed. SUCCESS!" || (echo "FAIL - Test(s) failed"; exit 1)
istanbul cover "$INDEX_JS" || ret=1;
elif [ "$1" = "-h" -o "$1" = "--help" ]; then
echo "Usage:
@ -24,5 +26,13 @@ elif [ "$1" = "-h" -o "$1" = "--help" ]; then
else
# Normal testing, no coverage analysis.
# Run the index.js test runner, which runs all the other tests.
"$NODEJS" --stack-trace-limit=100 "$INDEX_JS" $@ && echo "Test(s) passed. SUCCESS!" || (echo "FAIL - Test(s) failed"; exit 1)
"$NODEJS" --stack-trace-limit=100 "$INDEX_JS" $@ || ret=1;
fi
if [ $ret = '0' ]; then
echo "Test(s) passed. SUCCESS!"
else
echo "FAIL - Test(s) failed"
fi
exit $ret