forked from nmccartney/ngx-sails-socketio
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
99638e9
commit 5863fb7
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
|
||
# Script that runs simple tests or full integration tests based on $TEST_SUITE | ||
|
||
# The script should immediately exit if any command in the script fails. | ||
set -e | ||
set -o pipefail | ||
|
||
# Clean previous builds | ||
rm -rf tmp | ||
|
||
buildLibProject(){ | ||
LIB_FOLDER="tmp/my-ngx-library-$1" | ||
YO_RC="integrations/.yo-rc.$1.json" | ||
|
||
echo -e "\n" | ||
echo -e "#########################################\n" | ||
echo -e " Integration Test for $1 \n" | ||
echo -e "#########################################\n" | ||
|
||
echo "#1 - Creating lib folder at '$LIB_FOLDER'" | ||
mkdir -p $LIB_FOLDER | ||
|
||
echo "#2 - Copying .yo-rc.json to lib folder" | ||
cp $YO_RC "$LIB_FOLDER/.yo-rc.json" | ||
|
||
echo "#3 - Moving to lib folder" | ||
cd $LIB_FOLDER | ||
|
||
echo "#4 - Running generator for '$1'" | ||
yo ngx-library | ||
|
||
echo "#5 - Building library for '$1'" | ||
gulp build | ||
|
||
echo "#6 - Moving back to root folder" | ||
cd ../.. | ||
} | ||
|
||
runUnitTests(){ | ||
echo -e "\n" | ||
echo -e "#########################################\n" | ||
echo -e " Unit Tests \n" | ||
echo -e "#########################################\n" | ||
# Simply run unit tests | ||
gulp coveralls | ||
} | ||
|
||
runIntegrationTests(){ | ||
# Building and testing library project | ||
buildLibProject $1 | ||
} | ||
|
||
|
||
case $TEST_SUITE in | ||
"units") runUnitTests ;; | ||
"integrations:ng2") runIntegrationTests "ng2" ;; | ||
"integrations:ng4") runIntegrationTests "ng4" ;; | ||
"integrations:ng5") runIntegrationTests "ng5" ;; | ||
*) echo "Unknown value for 'TEST_SUITE': '$TEST_SUITE'. Aborting" | ||
exit 1 ;; | ||
esac | ||
|
||
exit 0 |