Skip to content

Commit

Permalink
Merge pull request #281 from adhocteam/cm-improve-readability-of-tests
Browse files Browse the repository at this point in the history
Improve test output  readability
  • Loading branch information
dcmcand authored Apr 15, 2021
2 parents bda7c95 + 728b5c5 commit f1dbbc1
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions bin/run-tests
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash

declare -a options=(frontend backend)
declare lr=">>>>>>>>"
declare -i exit_code=0
Expand All @@ -18,6 +17,7 @@ check_exit() {
main() {
local opt=""
local docker="true"
local verbose="false"

while [[ $# -gt 0 ]]
do
Expand All @@ -27,6 +27,10 @@ main() {
docker="false"
shift
;;
-v | --verbose)
verbose="true"
shift
;;
*)
for o in "${options[@]}"; do
if [[ "$key" == "$o" ]]; then
Expand Down Expand Up @@ -73,24 +77,32 @@ main() {

if [[ "$opt" == "backend" || -z "$opt" ]]; then
# Test backend
command="yarn test:ci --colors"
if [ $verbose == "false" ]; then
command="yarn test:ci --silent --colors"
fi
echo
log "Running backend tests"
if [[ $docker == "true" ]]; then
docker exec test-backend bash -c "yarn test:ci"
docker exec test-backend bash -c "$command"
else
yarn test:ci
$command
fi
check_exit "$?"
fi

if [[ "$opt" == "frontend" || -z "$opt" ]]; then
# Test frontend
command="yarn --cwd frontend run test:ci --colors"
if [ $verbose == "false" ]; then
command="yarn --cwd frontend run test:ci --silent --colors"
fi
echo
log "Running frontend tests"
if [[ $docker == "true" ]]; then
docker exec test-frontend bash -c "yarn --cwd frontend run test:ci"
docker exec test-frontend bash -c "$command"
else
yarn --cwd frontend run test:ci
$command
fi
check_exit "$?"
fi
Expand Down

0 comments on commit f1dbbc1

Please sign in to comment.