mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:37:36 +00:00
LibJS: run-test.sh emits test output if it is not "PASS"
Previously, debugging a test with console.log statements was impossible, because it would just cause the test to fail with no additional output. Now, if the output of a test is not "PASS", the output will be printed under the line where the test failed. Empty output will have a special message attached to it -- useful when a test author has forgotten to include `console.log("PASS")` at the end of a test.
This commit is contained in:
parent
981f403287
commit
53f1090b86
1 changed files with 16 additions and 0 deletions
|
@ -31,6 +31,22 @@ for f in *.js; do
|
|||
fi
|
||||
echo -ne "\033]9;${count};${test_count}\033\\"
|
||||
echo "$f"
|
||||
|
||||
if [ "$result" != "PASS" ]; then
|
||||
if [ -z "$result" ]; then
|
||||
echo -e " \033[31;1mNo output. Did you forget 'console.log(\"PASS\");'?\033[0m"
|
||||
else
|
||||
readarray -t split_result <<< "$result";
|
||||
|
||||
echo -ne " \033[31;1mOutput:\033[0m: "
|
||||
echo "${split_result[0]}";
|
||||
|
||||
for (( i = 1; i < ${#split_result[@]}; i++ )); do
|
||||
echo " ${split_result[i]}"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
(( ++count ))
|
||||
done
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue