-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
734 additions
and
92 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,73 @@ | ||
cd ../source/cdk | ||
npm install --silent | ||
npm test | ||
#!/bin/bash | ||
|
||
cd ../custom-resource | ||
npm install --silent | ||
npm test | ||
[ "$DEBUG" == 'true' ] && set -x | ||
set -e | ||
|
||
cd ../job-submit | ||
npm install --silent | ||
npm test | ||
prepare_jest_coverage_report() { | ||
local component_name=$1 | ||
|
||
cd ../job-complete | ||
npm install --silent | ||
npm test | ||
if [ ! -d "coverage" ]; then | ||
echo "ValidationError: Missing required directory coverage after running unit tests" | ||
exit 129 | ||
fi | ||
|
||
# prepare coverage reports | ||
rm -fr coverage/lcov-report | ||
mkdir -p $coverage_reports_top_path/jest | ||
coverage_report_path=$coverage_reports_top_path/jest/$component_name | ||
rm -fr $coverage_report_path | ||
mv coverage $coverage_report_path | ||
} | ||
|
||
run_javascript_test() { | ||
local component_path=$1 | ||
local component_name=$2 | ||
|
||
echo "------------------------------------------------------------------------------" | ||
echo "[Test] Run javascript unit test with coverage for $component_name" | ||
echo "------------------------------------------------------------------------------" | ||
echo "cd $component_path" | ||
cd $component_path | ||
|
||
# install dependencies | ||
npm install --silent | ||
# run unit tests | ||
npm test | ||
|
||
|
||
|
||
# prepare coverage reports | ||
prepare_jest_coverage_report $component_name | ||
} | ||
|
||
# Get reference for all important folders | ||
template_dir="$PWD" | ||
source_dir="$template_dir/../source" | ||
coverage_reports_top_path=$source_dir/test/coverage-reports | ||
|
||
# Test the attached Lambda function | ||
declare -a lambda_packages=( | ||
"cdk" | ||
"custom-resource" | ||
"job-complete" | ||
"job-submit" | ||
) | ||
|
||
for lambda_package in "${lambda_packages[@]}" | ||
do | ||
rm -rf $source_dir/$lambda_package/coverage | ||
mkdir $source_dir/$lambda_package/coverage | ||
run_javascript_test $source_dir/$lambda_package $lambda_package | ||
|
||
# Check the result of the test and exit if a failure is identified | ||
if [ $? -eq 0 ] | ||
then | ||
echo "Test for $lambda_package passed" | ||
else | ||
echo "******************************************************************************" | ||
echo "Lambda test FAILED for $lambda_package" | ||
echo "******************************************************************************" | ||
exit 1 | ||
fi | ||
|
||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.