forked from aws-solutions/qnabot-on-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-all-tests.sh
executable file
·45 lines (37 loc) · 1.55 KB
/
run-all-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
[ "$DEBUG" == 'true' ] && set -x
set -e
run_javascript_lambda_test() {
lambda_name=$1
lambda_description=$2
echo "------------------------------------------------------------------------------"
echo "[Test] Javascript Lambda: $lambda_name, $lambda_description"
echo "------------------------------------------------------------------------------"
cd $source_dir/lambda/$lambda_name
[ "${CLEAN:-true}" = "true" ] && npm run clean
npm ci
npm test
if [ "$?" = "1" ]; then
echo "(run-all-tests.sh) ERROR: there is likely output above." 1>&2
exit 1
fi
[ "${CLEAN:-true}" = "true" ] && rm -rf coverage/lcov-report
}
# Save the current working directory and set source directory
source_dir=$PWD
cd $source_dir
# Option to clean or not clean the unit test environment before and after running tests.
# The environment variable CLEAN has default of 'true' and can be overwritten by caller
# by setting it to 'false'. Particularly,
# $ CLEAN=false ./run-all-tests.sh
#
CLEAN="${CLEAN:-true}"
echo "Starting Lambda unit tests"
run_javascript_lambda_test connect "Connect Lambda Unit Tests"
run_javascript_lambda_test genesys "Genesys Lambda Unit Tests"
run_javascript_lambda_test js_lambda_hook_sdk "JS Lambda Hook SDK Unit Tests"
run_javascript_lambda_test qnabot-common-layer "QnaBot Common Layer Lambda Unit Tests"
run_javascript_lambda_test schema "Schema Lambda Unit Tests"
run_javascript_lambda_test translate "Translate Lambda Unit Tests"