mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
LibJS: Reformat run-tests.sh output
- Use emojis instead of the pass/fail text - Fix the new version of the script to run inside Serenity - Don't print erroneous output after 'Output:'; start on a newline instead - Skip 'run-tests.sh' while testing
This commit is contained in:
parent
d5beaa497f
commit
6af3fff0c2
1 changed files with 10 additions and 10 deletions
|
@ -16,25 +16,26 @@ test_count=0
|
||||||
|
|
||||||
GLOBIGNORE=test-common.js
|
GLOBIGNORE=test-common.js
|
||||||
|
|
||||||
test_files=$(find . -type f -name "*.js" | cut -c 3- | sort)
|
# FIXME: Support "find -name" in Serenity to remove the file name checks below
|
||||||
|
test_files=$(find . -type f | cut -b 3- | sort)
|
||||||
|
|
||||||
for f in $test_files; do
|
for f in $test_files; do
|
||||||
if [ "$f" = "test-common.js" ]; then
|
if [ "$f" = "test-common.js" ] || [ "$f" = "run-tests.sh" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
(( ++test_count ))
|
(( ++test_count ))
|
||||||
done
|
done
|
||||||
|
|
||||||
for f in $test_files; do
|
for f in $test_files; do
|
||||||
if [ "$f" = "test-common.js" ]; then
|
if [ "$f" = "test-common.js" ] || [ "$f" = "run-tests.sh" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
result="$("$js_program" "$@" -t "$f" 2>/dev/null)"
|
result="$("$js_program" "$@" -t "$f" 2>/dev/null)"
|
||||||
if [ "$result" = "PASS" ]; then
|
if [ "$result" = "PASS" ]; then
|
||||||
(( ++pass_count ))
|
(( ++pass_count ))
|
||||||
echo -ne "( \033[32;1mPass\033[0m ) "
|
echo -ne " ✅ "
|
||||||
else
|
else
|
||||||
echo -ne "( \033[31;1mFail\033[0m ) "
|
echo -ne " ❌ "
|
||||||
(( ++fail_count ))
|
(( ++fail_count ))
|
||||||
fi
|
fi
|
||||||
echo -ne "\033]9;${count};${test_count}\033\\"
|
echo -ne "\033]9;${count};${test_count}\033\\"
|
||||||
|
@ -42,15 +43,14 @@ for f in $test_files; do
|
||||||
|
|
||||||
if [ "$result" != "PASS" ]; then
|
if [ "$result" != "PASS" ]; then
|
||||||
if [ -z "$result" ]; then
|
if [ -z "$result" ]; then
|
||||||
echo -e " \033[31;1mNo output. Did you forget 'console.log(\"PASS\");'?\033[0m"
|
echo -e " \033[31;1mNo output. Did you forget 'console.log(\"PASS\");'?\033[0m"
|
||||||
else
|
else
|
||||||
readarray -t split_result <<< "$result";
|
readarray -t split_result <<< "$result";
|
||||||
|
|
||||||
echo -ne " \033[31;1mOutput:\033[0m "
|
echo -e " \033[31;1mOutput:\033[0m "
|
||||||
echo "${split_result[0]}";
|
|
||||||
|
|
||||||
for (( i = 1; i < ${#split_result[@]}; i++ )); do
|
for (( i = 0; i < ${#split_result[@]}; i++ )); do
|
||||||
echo " ${split_result[i]}"
|
echo " ${split_result[i]}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue